Partner sites: Aminet - Amiga downloadsIntuitionBase - Amiga guidesAmigaNN - Amiga newsAmiFund - Sponsor projects

[Y]UtilityBase
Your guide to Amiga development
Not logged in
  HomeProjectsForumArticlesResourcesLinksChatAbout 
Search
Login
Username:
Password:
Register now!
Forgot your password?
Aminet - Development
Draco-src.lha (dev/lang)
peg-v0.1.4.tar.gz (dev/c)
peg-0.1.4-src.tar.gz (dev/c)
batari_Basic.lha (dev/cross)
pixman-src_aros.lha (dev/lib)
pixman_i386-aros.lha (dev/lib)
cairo-1.5.8-src_aros.lha (dev/lib)
cairo-1.5.8_i386-aros.lha (dev/lib)
vbcc_PosixLib.lha (dev/c)
IFF-RGFX.zip (dev/misc)
More...
Newest users
Tinlau
Lullaby20 (Erika)
alfkil (Alfkil Wennermark)
lole (Olle)
jeanluc72

Pending:
ZebraZeem, Mad_Dog, hhjoker, voxel, JosDuchIt, MarcB, MarBo, Sollaris, sara, species
More...
Who's Online
Online members:

salass00$10 min(s) ago
Amigaharry 34 min(s) ago

12 guests are online.

You are an Anonymous user. You can register for free by clicking here.
News sites
Amiga-News.de
Amiga.org
AmigaDev.net
AmigaNN
Amigans.net
Amigaweb.net
AmigaWorld.net
AROS-Exec
MorphOS-News.de
MorphZone
polarBoing
Tutorials
Installing the latest OS4 SDK in Cubic IDE
Writing Installer scripts for AmiUpdate
Cross Compiling for OS4 or OS3 using MS Visual Studio 2005
Installing an AmigaOS 4 cross compiler
Size does matter: Optimizing with size in mind with GCC
More...
Sources
Install SObjs with Installer
How to make clean picture datatypes
Most of the old ClassACT examples converted to OS4
AmigaAnywhere Tutorial - Part 2 Source window1.c
AmigaAnywhere Tutorial - Part 2 Source window2.c
More...
Documentations
How to write portable code for Amiga (english)
Comment écrire du code portable pour Amiga (français)
Development How to with OS3.9 SDK
The PartyPack Hack
The Amiga PDA Programming Guidelines
More...
DreamHost

Support
UtilityBase

[Valid RSS]

UtilityBase needs your help!

Writing Installer scripts for AmiUpdate
by Chris Young
Link: Writing Installer scripts for AmiUpdate

Installer usually prompts for input and confirmation, which is not ideal for an automatic update procedure such as AmiUpdate uses. With some care, however, Installer can be made to install or update software without any user intervention. This guide describes how to achieve this using AmiUpdate's AutoInstall mechanism, and modification to an existing script.

Calling Installer from AutoInstall

AmiUpdate executes an AmigaDOS script called AutoInstall in the root of the archive.This script is a key part of the setup of Installer, to enable suppressing of prompting later.The script must CD to the directory which holds the installation script, and then call Installer with the following arguments:

Installer Install APPNAME AppAutoInstall DEFUSER NOVICE

Install should be the name of the Installer script, and AppAutoInstall can be anything you like, as long as it isn't the same as the APPNAME tooltype in the install script's icon.DEFUSER NOVICE stops Installer asking the user for the majority of tasks, even if (confirm) is used.

Essential Installer script changes

Normally the first thing the user has to do when starting up an Installer script is answer some questions on how knowledgeable they are about AmigaOS, and whether they want a logfile created.This appears when Installer encounters the (welcome) command, or at the very start if there is no welcome command in the script.

We must modify our existing script so (welcome) does not get called if it has been started from AutoInstall, by replacing it with the following two lines:

(if (= @app-name "AppAutoInstall") (set #AutoInstall 1))
(if (<> #AutoInstall 1) (welcome))

AppAutoInstall must be changed to the APPNAME given in the Installer command line earlier.The first line uses this to set a variable if the script was started by AutoInstall.The second line shows the welcome screen only if the script was started manually.

The second prompt that Installer always gives by default, is when it reaches the (exit) command or at the very end of the script.To counteract this, the (quiet) option of (exit) can be used.To ensure the script only exits quietly when being AutoInstalled, the following commands can be used:

(if (= #AutoInstall 1)
(
(exit (quiet))
)
; else
(
(exit)
)
)

Other Installer script changes

Even with the above changes, it is likely the script is still asking where it needs to be installed.As part of AmiUpdate, the application must write an environmental variable containing the path it is installed in.We can read this using Installer and use it as the destination for the rest of the process, as follows:

(set @default-dest (getenv "AppPaths/App"))

Where AppPaths/App is the env-var written by the application.The (askdir) command can then be bypassed - usually adding (default @default-dest) is sufficient to stop it appearing.

An advantage of using AmiUpdate is the rollback functionality utilised by copying files with CopyStore.This can be called by Installer quite happily, but remember to only call it if AmiUpdate has invoked the script and use (copylib) or (copyfiles) in other cases.eg:

(if (= #AutoInstall 1)
(
(run "CopyStore App " @default-dest)
)
; else
(
(copylib ...)
)
)

App is the name of the file to be copied.

Any other questions the Installer script needs to ask should be skipped and provided with sensible defaults, if #AutoInstall is 1.

Always test your script with TestAutoInstall from the AmiUpdate website.

Rate this item
12345678910



:: Your comment
Bold Style  Italic Style  Underlined Style  Image Link  Insert URL  Email Link  Quote  C/C++ Source  Disable *What`s that?


Before posting non-english message, check your browser`s encoding!
» Name » Password

UtilityBase is a site focused on development for Amiga systems,
spanning over all different Amiga clones, that be AmigaOS 3.x, 4.x, MorphOS, AROS or AmigaDE/Anywhere.
News syndication: RSS
Contact address: mail@utilitybase com