Home  
Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
73 user(s) are online (63 user(s) are browsing Forums)

Members: 0
Guests: 73

more...
Support us!
Recent OS4 Files
OS4Depot.net





Example install scripts
Just popping in
Joined:
2015/9/28 23:42
From Bettendorf, IA, USA
Posts: 121
I started to update my Workbench Explorer installer script to use the OS4 Installation Utility.

This is totally different than the old installer. Does any one have, or know of, some scripts I can look at to get me started?

Simpler the better: Welcome, install where?, install some catalogs?, do the install, goodbye.

   Report Go to top

Re: Example install scripts
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1526
@mritter0

There's an example script on the AmigaOS wiki:

http://wiki.amigaos.net/wiki/Installation_Utility#Example_script

   Report Go to top

Re: Example install scripts
Just can't stay away
Joined:
2006/12/4 23:15
Posts: 1883
@mritter0
Here is the installer for AOrganiser.

It's bit more complex, shows usage of GUI elements, and page handlers, as well as using python modules to add further functionality.

#
# AOrganiser installer 
#
# $VER: AOrganiser Install 1.1 (2.5.2017)
#

#################################################
import installer
from installer import 
*
import os
import sys
import shutil


havevars 
True
try:
    
import amigavars
except ImportError
:
    
havevars False

def GetEnv
(varname):
    if 
havevars:
        return 
amigavars.GetEnv(varname)
    else:
        
varfile os.path.join("ENV:",varname)
        
value None
        
try:
            
open(varfile,"r")
            if 
f:
                
value f.readline()
                
f.close()
            return 
value
        except IOError
:
            return 
None



#################################################
welcome """Welcome to the AOrganiser Diary Installation

This installation script will guide you through the process of installing the AOrganiser application to your prefered location on your system.

Please note: When you are asked for the location to install AOrganiser a directory called AOrganiser will be created at your chosen location.

This install script will also highlight and download any missing dependencies with the exception of AmiSSL 4, which will need to be preinstalled by the end user.
"""

def fixEmailMime():
    try:
        
import email.mime
    except ImportError
,e:
        
os.system("echo NOLINE "" >python:lib/email/mime/__init__.py")

def fetchArchive(url):
    
sys.path.append('AOrganiser/Scripts/')
    
from CalDAV.oauth2client import httplib2
    
    http 
httplib2.Http(disable_ssl_certificate_validation=True)
    (
response,content) = http.request(url,method "GET")
    
status int(response['status'])
    if (
status >= 200) and (status 299):
        if 
'content-disposition' in response:
            
disp response['content-disposition'].split(';')
            if 
disp[0] == "attachment":
                
junk,filename disp[1].split('=')
                
filename filename.strip(""")
        else:
            filename = url.split("
/")[-1]
        f = open(filename,"
w")
        if f:
            f.write(content)
            f.close()
            return filename
    return None
        
#################################################

def finalProc(page):
    destination = GetString(destinationPage,"
destination")
    SetString(page,"
message","AOrganiser is now installed to %s" % destination)
    if freshProActionInstall:
        current = os.getcwd()
        os.chdir(os.path.join(destination, "
ProAction/"))
        print "
Starting ProActionCTRL to add ProAction to Appdir:"
        os.system("
run >NILpython ProActionCtrl")
        os.chdir(current)
    scripts = ["
Scripts/SearchGUI.py","Scripts/CalDAV/DeleteCalDAV.py",
        "
Scripts/CalDAV/ExportSelected.py",
        "
Scripts/CalDAV/GoogleSetUpWizard.py",
        "
Scripts/CalDAV/ReplyCalDAV.py",
        "
Scripts/CalDAV/ResetCalDAVScripts.py",
        "
Scripts/CalDAV/SyncToCalDAV.py",
        "
Scripts/CalDAV/UpdateCalDAV.py"]
    for s in scripts:
        script = os.path.join(destination,"
AOrganiser",s)
        os.system("
PROTECT "" script "" +s")
    return True
    


#################################################
# Get dependnecies 

# ProAction

freshProActionInstall = False

f = os.popen("
VERSION APPDIR:ProAction")

vers = None

if f:
    vers = f.read().strip("
n")
    f.close()

if vers != None and vers[:7] != "
VERSION":
    proactionVers = vers.split(" ")[1]
    version,revision = proactionVers.split("
.")
    proactionVersion = int(version)
    proactionRevision = int(revision)
else:
    proactionVers = None

# AmigaVars

try:
    import amigavars
    haveAmigaVars = True
except ImportError:
    haveAmigaVars = False

# PythonSSL 

try:
    import socket
    import _ssl
    havePythonSSL = True
except ImportError:
    havePythonSSL = False
    
##################################################

def installProAction():
    global freshProActionInstall
    
    installedpath = GetEnv("
Appdir/Proaction")
    print "
Fetching the ProAction Archive from os4depot.net"
    archive = fetchArchive("
http://os4depot.net/share/library/reaction/proaction.lha")
    
if archive:
        
os.system("SYS:Utilities/UnArc FROM " archive " TO CURRDIR: AUTO QUIET")
        
myFiles = ["ProAction","ProAction.info"]

        if 
installedpath:
            if 
os.path.basename(installedpath).upper() == "PROACTION":
                
installedpath os.path.dirname(installedpath)
                
proactionpkg AddPackage(FILEPACKAGE,
                    
name="ProAction Package",
                    
alternatepath installedpath,
                    
description="",
                    
files myFiles
                
)
            else:
                
os.system("C:RequestChoice "File Downloaded" "You appear to have ProAction installed in an unusual way*NThe archive has been downloaded for you to custom install by hand" "OK" >NIL:")
        else:
            
proactionpkg AddPackage(FILEPACKAGE,
                
name="ProAction Package",
                
description="",
                
files myFiles
            
)
            
freshProActionInstall True
    
else:
        
os.system("C:RequestChoice "Download Failed" "Unable to download the ProAction archive" "OK" >NIL:")
        
def installAmigaVars():
    
archive fetchArchive("http://os4depot.net/share/development/library/amigavars.lha")
    print 
"Fetching the AmigaVars Archive from os4depot.net"
    
if archive:
        
os.system("SYS:Utilities/UnArc FROM " archive " TO CURRDIR: AUTO QUIET")
        
shutil.copy2("amigavars.so","PYTHON:Lib/site-packages/amigavars.so")
    else:
        
os.system("C:RequestChoice "Download Failed" "Unable to download the AmigaVars archive" "OK" >NIL:")
        
def moveToBackUp(filename):
    
success False
    i 
1
    
while not success:
        
backupname filename "." str(i)
        try:
            
shutil.move(filename,backupname)
            
success True
        except
:
            
1

def installPythonSSL
():
    
archive fetchArchive("http://os4depot.net/share/library/misc/pythonssl.lha")
    print 
"Fetching the PythonSSL Archive from os4depot.net"
    
if archive:
        
os.system("SYS:Utilities/UnArc FROM " archive " TO CURRDIR: AUTO QUIET")
        
moveToBackUp("PYTHON:Lib/lib-dynload/select.so")
        
shutil.copy2("pythonssl/select.so","PYTHON:Lib/lib-dynload/select.so")
        
        
moveToBackUp("PYTHON:Lib/lib-dynload/_socket.so")
        
shutil.copy2("pythonssl/_socket.so","PYTHON:Lib/lib-dynload/_socket.so")
        
        
shutil.copy2("pythonssl/_ssl.so","PYTHON:Lib/lib-dynload/_ssl.so")
    else:
        
os.system("C:RequestChoice "Download Failed" "Unable to download the PythonSSL archive" "OK" >NIL:")

def installDeps(page):

    if 
depsProActionCB:
        
checked GetUIAttr(depsPage,depsProActionCB,GUI_CHECKED)
        if 
checked:
            print 
"Installing ProAction!"
            
installProAction()
    if 
depsAmigaVarsCB:
        
checked GetUIAttr(depsPage,depsAmigaVarsCB,GUI_CHECKED)
        if 
checked:
            print 
"Installing AmigaVars!"
            
installAmigaVars()
    if 
depsPythonSSLCB:
        
checked GetUIAttr(depsPage,depsPythonSSLCB,GUI_CHECKED)
        if 
checked:
            print 
"Installing PythonSSL!"
            
installPythonSSL()
    return 
True
            
##################################################
welcomePage NewPage(WELCOME)
SetString(welcomePage"message" welcome)

NewPage(README)
NewPage(LICENSE)

depsPage NewPage(GUI)

depsProActionCB None
depsAmigaVarsCB 
None
depsPythonSSLCB 
None

StartGUI
(depsPage)

BeginGroup(orientation=GROUP_VERTICAL,label="Dependencies"frame=GROUP_FRAME)
BeginGroup(orientation=GROUP_VERTICALlabel="ProAction"frame=GROUP_FRAME,weight=1)
if 
proactionVers:
    
AddLabel(label="ProAction Version " proactionVers " is installednProAction Version 1.8 and up is recomended")
    
    if (
proactionVersion 1) or (proactionVersion <= and proactionRevision 8):
        
depsProActionCB AddCheckBox(label="Upgrade ProAction"checked=True)
else:
    
AddLabel(label="ProAction is not installednProAction Version 1.8 is recomended")
    
depsProActionCB AddCheckBox(label="Install ProAction"checked=True)
    
EndGroup()

BeginGroup(orientation=GROUP_VERTICALlabel="AmigaVars"frame=GROUP_FRAME,weight=1)
if 
haveAmigaVars:
    
AddLabel(label="The Amiga Vars module is installednNo Action required")
else:
    
AddLabel(label="The Amiga Vars module is recommended to allow some scripts to save settings etcn")
    
depsAmigaVarsCB AddCheckBox(label="Install AmigaVars"checked=True)
EndGroup()

BeginGroup(orientation=GROUP_VERTICALlabel="PythonSSL"frame=GROUP_FRAME,weight=1)
if 
havePythonSSL:
    
AddLabel(label="The PythonSSL module is installednNo Action required")
else:
    
AddLabel(label="The PythonSS module is recommended to allow access to https URLSn")
    
depsPythonSSLCB AddCheckBox(label="Install PythonSSL"checked=True)
EndGroup()

EndGroup()
EndGUI()

destinationPage NewPage(DESTINATION)
SetObject(destinationPage"entryhandler"installDeps)

installPage NewPage(INSTALL)
SetString(installPage"message" "Please select a location to install AOrganisernAn drawer named AOrganiser will be created there:")
    
finalPage NewPage(FINISH)
SetString(finalPage"message" "")
SetObject(finalPage"entryhandler"finalProc)


##############################################
# Set up the packages we need

myFiles = ["AOrganiser","AOrganiser.info"]

package AddPackage(FILEPACKAGE,
    
name="AOrganiser Package",
    
description="",
    
files myFiles
    
)
    

fixEmailMime()
#fetchArchive("http://os4depot.net/share/library/reaction/proaction.lha")
#fetchArchive("http://os4depot.net/share/development/library/amigavars.lha")
#fetchArchive("http://os4depot.net/share/library/misc/pythonssl.lha")

RunInstaller()

_________________
Blender For OS4.x : Blues : Walker Broad
   Report Go to top

Re: Example install scripts
Just popping in
Joined:
2015/9/28 23:42
From Bettendorf, IA, USA
Posts: 121
After several hours I got what I wanted to work. A little bit of a learning curve.

_________________
Workbench Explorer - A better way to browse drawers
   Report Go to top





[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project