Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
102 user(s) are online (96 user(s) are browsing Forums)

Members: 1
Guests: 101

nbache, more...

Support us!

Headlines

 
  Register To Post  

Example install scripts
Just popping in
Just popping in


See User information
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.

Go to top
Re: Example install scripts
Just can't stay away
Just can't stay away


See User information
@mritter0

There's an example script on the AmigaOS wiki:

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

Go to top
Re: Example install scripts
Home away from home
Home away from home


See User information
@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 installed\nProAction 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 installed\nProAction 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 installed\nNo Action required")
else:
    
AddLabel(label="The Amiga Vars module is recommended to allow some scripts to save settings etc\n")
    
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 installed\nNo Action required")
else:
    
AddLabel(label="The PythonSS module is recommended to allow access to https URLS\n")
    
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 AOrganiser\nAn 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()

Go to top
Re: Example install scripts
Just popping in
Just popping in


See User information
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
Go to top
Re: Example install scripts
Home away from home
Home away from home


See User information
@All
Just a bit necro this topic, can anybody point out if i can change the text of the title in the window when use installation utility ?

i just tried example script from Wiki, and it show in the name of window "Installation Utility" words.

Also, is it possible to "center" the text, like for example i want WelcomeText = "test" , be written right in the center of the welcome page ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Example install scripts
Not too shy to talk
Not too shy to talk


See User information
@mritter0

The old installer used to cause scare stories. I see the new generation will now have new installer scare stories. I haven't tried the old LISP even yet I'm afraid of the new Python slithering around OS4 now.

You could always write an AmigaDOS script and write your own.

You've solved it now but I was going to recommend HexSee by Steady here. I took a look. And found this to be a good example of how simple it can actually be:
http://os4depot.net/index.php?functio ... ility/filetool/hexsee.lha

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project