Table of Contents
The post-installation feature works for FAT16/32, NTFS, and Ext2 file systems. In particular, the Windows NT4, XP and 2000 OS have been successfully tested.
Four types of post-installation are available:
Image post-installation. For each disk image you can choose, from Webmin, a post-installation script which will be executed after restoring the image. This post-installation should be used to customize a mass Operating System deployment.
Computer post-installation. For each computer you can choose, from Webmin, a post-installation script which will be executed when the boot menu entry "Post-Install" will be chosen. This post-installation should be used to deploy applications.
Group post-installation. The shared image "Post-installation (group)" can be used to assign the same post-installation script to the clients which have this image in their boot menu.
A global post-installation, which will be executed in both cases and for all computers. This option is not available in the Webmin interface, but only in the command line interface.
The provided scripts can deal with a wide range of deployment situations:
No postinstall: none script will be run.
date1: write the current date in the "date.txt" file which will be located on the root directory of the first partition of the first hard drive.
ich5raid1: synchronize the 1st and the 2nd hard disk on "fake raid" ICH5 cards.
lscssh: install SSH and the public key for the Linbox Secure Control module.
lscsshvnc: install SSH with the public key for the Linbox Secure Control module, and a secure VNC server.
ntfsresize1: maximize the 1st and only one NTFS partition.
ntfsresize2: maximize the 2nd and last NTFS partition.
resize1: maximize the 1st and only one, FAT, EXT2/3 or ReiserFS3 partition.
run1: install files contained in /tftpboot/revoboot/images/data/ to the first partition in \tmp, and runs a program, C:\tmp\myprogram.bat, during the first boot of a Microsoft Windows system.
run2: as previously, on the second partition.
shell: simple debug shell.
shutdown1:shutdown the client after the restoration.
sid1: reset a post-Windows 2k SID (and its NetBios name) of a MS Windows system.
sysprep1: copy /tftpboot/revoboot/images/data/sysprep.inf to the first partition of the first disk, and change the NetBios name with the one declared in the LRS.
vnc1: install TightVNC (client part of the remote control module) during the first boot of a Microsoft Windows system.
Those scripts are only basic examples. To explore the infinite possibilities of the post-installation feature, you will have to modify existing scripts - even create a new one - you can do it by clicking on the "Edit" button, as explained below.
After clicking on the "Edit" button on the right of the scripts list, the LRS will display the following form:
![]() |
|---|
| Main form to edit post-installation scripts |
This form enables you to perform four different actions on the post installation scripts: creation, duplication, suppression and modification.
Creation:

Post installation scripts creation form You will have to fill two fields:
The post-installation file location (only relative to images/templates for now, that is to say the common place for every images)
The script's name
![[Warning]](/ucome.rvt/any/en/Produits/LRS/details/doc/img/warning.png)
The scripts are created without content. You may edit the scripts later.
Duplication:

Post installation scripts duplication form You will have to fill two fields:
The post-installation file location (only relative to images/templates for now, that is to say the common place for every images)
The script's name
Suppression:

Post installation scripts suppression form Edition:

Post installation scripts edition form This form is in three parts:
The Description field enables you to briefly describe the script's function (which will be displayed on the details page).
The Comments field is used to complete the previous description.
The next fields represent the lines from the post-installation script itself, one field by line (see below for a full description).
A "suppress" button in front of each line to delete the line on their right.
There is also three buttons at the end of the form, to respectively add a new line, to reinitialize the fields values and to save yours changes.
You will find more technical information about the different commands available in the sections below.
The post-installation scripts are shell scripts. On LRS, the scripts are located in the directory /tftpboot/revoboot/images/templates
To enable cross-edition between the command line interface and the webmin interface, post-installation scripts must respect a strict syntax.
Here is an example:
# This is the description # # This is a shell fragment # Auto-generated from the webmin interface on Thu Aug 19 12:27:11 CEST 2004 # Please don't modify it unless you know what you are doing ! # Please don't remove « END HEADER » and « END COMMENT » #-- END HEADER --# # This is a comment. # Comment can be sparse # across several lines. #-- END COMMENTS --# Mount 1 date > /mnt/date.txt cp /opt/winutils/inventory-setup.exe /mnt/tmp/setup.exe RegistryAddRunOnce c:\tmp\setup.exe ChangeSIDAndName
which corresponds to the following form:
![]() |
|---|
| Post-installation scrip editing form |
As you can edit these script either using webmin's interface or a simple text editor, some precautions must be taken when using a text editor:
The first line is always used as a description for the script. It corresponds to the "description" field of the form.
The lines between the "-- END HEADER --" and "-- END COMMENTS --" lines correspond to the "comments" field of the form.
The lines between the first one and "-- END HEADER --" are generated by webmin after each save using the form.
The "-- END HEADER --" and "-- END COMMENTS --" lines should never be deleted. These lines are used as beacons by Webmin.
Each line after the "-- END COMMENTS --" line corresponds to a command.
| Directory on the client | Equivalent directory on the server | Content |
|---|---|---|
| /mnt | n.a. | Mount point of the target file system |
| /revoinfo | /tftpboot/revoboot/images | /tftpboot/revoboot/images directory path on the server (NFS mount) |
| /revoinfo/data | /tftpboot/revoboot/images/data | User data. With our pre-configured LRS, this directory can be accessed from Windows clients as the 'data' share. |
| /revosave | variable | Image data, only if the post-installation is linked to a particular image |
| /opt | /tftpboot/revoboot/lib/util | A handful of tools and utilities used by the post-inst scripts |
/revoinfo/initinst
/revosave/initinst (if /revosave exists, see above)
(possible installation or backup)
/revoinfo/preinst
/revoinfo/$MAC/postinst
/revosave/postinst (if /revosave exists, see above)
/revoinfo/postinst
The 'postinst' and 'preinst' scripts will always be run whatever the restoration method is (tftp, nfs or multicast). However, 'initinst' scripts will only be run during nfs or multicast restorations.
Moreover, the Web interface is limited to the edition of '/revoinfo/$MAC/postinst' and '/revosave/postinst' scripts.
Some environment variables are available to be used in the scripts:
| Variable | Aim |
|---|---|
| $IPSERVER | The LRS IP address |
| $MAC | The current machine MAC address, compact (001122334455) |
| $HOSTNAME | The current machine hostname (using the content of the LRS database) |
| Command | Description | |||
|---|---|---|---|---|
| Mount <DEVICE> | Mount the<DEVICE> Windows partition on /mnt <DEVICE> can be
Example:
| |||
| NtfsResize <PART> <SIZE> | Resize the primary partition <PART> of the 1st
disk to the size <SIZE>, which can be given in MB, GB,
or in percentage of the whole disk. Works only for NTFS and
for the last disk partition. Examples:
| |||
| NtfsResizeMax <PART> | Shortcut forNtfsResize <PART> 100% | |||
| RegistryAddKey <PATH> <KEY> ... <KEY> | Add one or more keys <KEY> in the <PATH> branch of the registry database in the /mnt windows installation. Example: RegistryAddKey "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\" System Scripts
| |||
| RegistryAddString <PATH> <NAME> <VALUE> | Add the <NAME> value, and assign it <VALUE> in the <PATH> branch of the registry database in the /mnt windows installation.
Example: RegistryAddString "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" SETUP setup.exe
| |||
| RegistryAddRunOnce <VALUE> | Shortcut for RegistryAddString "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce" LRS <VALUE> | |||
| RegistryAddRun <VALUE> | Shortcut for RegistryAddString "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" LRS <VALUE> | |||
| Resize <PART> <SIZE> | Resize the primary partition <PART> of the 1st
disk to the size <SIZE>, which can be given in MB, GB,
or in percentage of the whole disk. Supports FAT16/32, EXT2/3
and Reiserfs 3. Examples:
| |||
| ResizeMax <PART> | Shortcut forResize <PART> 100% | |||
| CopySysprepInf <FILE> | Copy the <FILE> file to \sysprep\Sysprep.inf on /mnt and replace the ComputerName entry with machine name as declared in the LRS. Example:
| |||
| ChangeSID | Changes the machine's SID using newsid.exe . | |||
| ChangeSIDAndName | Changes the machine's SID and Netbios name. The name comes from the LRS. | |||
| revosetdefault <VALUE> | Change the default menu entry (0=1st one) |
Busybox is available for the post-installation, so the following commands can be used:
[, ash, basename, busybox, cat, chgrp, chmod, chown, chvt, clear, cp, cut, date, dd, df, dirname, dmesg, dos2unix, du, echo, env, false, find, free, grep, gunzip, halt, head, id, ifconfig, init, insmod, kill, killall, klogd, linuxrc, ln, logger, ls, lsmod, mkdir, modprobe, more, mount, mv, pidof, ping, poweroff, ps, pwd, reboot, reset, rm, rmdir, route, sed, sh, sleep, sort, stty, sync, syslogd, tail, telnet, test, touch, tr, true, tty, umount, uname, uniq, unix2dos, wc, which, whoami, xargs, yes, zcat.
The "initinst" script checks that a file is present (\reinstall.me) on the first MS Windows partition before installing the new image. If the file is not present, it sets the default boot menu entry to 0 (usually, boot to local HD) and reboots. It should be copied to the corresponding image directory (/tftpboot/revoboot/imgbase/Base-NN for example).
Mount 1
if [ ! -r /mnt/reinstall.me ]
then
umount /mnt
revosetdefault 0
reboot
fiBefore creating the image you will deploy:
Install Microsoft Sysprep tools on C:\sysprep (For more information on Sysprep, you can readhttp://support.microsoft.com/default.aspx?scid=kb;en-us;298491 ). Sysprep tools can be found in the OS installation CD in Support\Tools\Deploy.
Launch under a MS Windows shell, "cd c:\sysprep" and "sysprep /quiet /reboot".
Create a "sysprep.inf" file, such as the example, in the "data" LRS shared folder (example for Windows 2000 and Sysprep 1.x):
[Unattended]
OemSkipEula=Yes
InstallFilesPath=C:\sysprep
TargetPath=\WINNT
[GuiUnattended]
AdminPassword=root
OEMSkipRegional=1
TimeZone=85
OemSkipWelcome=1
[UserData]
ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
FullName=Name
OrgName=Org
ComputerName=NETBIOS_NAME
[Display]
BitsPerPel=16
Xresolution=1024
YResolution=768
Vrefresh=70
[SetupMgr]
DistFolder=C:\sysprep\i386
DistShare=win2000dist
[Identification]
JoinDomain=DOMAIN
DomainAdmin=domainadmin
DomainAdminPassword=password
[Networking]
InstallDefaultComponents=YesWith this sample file, various parameters will be changed, such as, the administrator's password (AdminPassword=), the screen resolution, and the 'DOMAIN' domain (JoinDomain=) will be joined, a machine account will be created using the domain admin login and password (DomainAdmin= and DomainAdminPassword=). More parameters can be changed and are widely documented at http://support.microsoft.com.
Next, create a shared image and attach "sysprep1" post-installation script to this new image.
After deploying the image, the global Sysprep.inf file will be copied in C:\Sysprep, the Netbios name (ComputerName=) will be replaced by the one declared in the LRS, and finally, Windows and Sysprep will be run.
![]() | |
Running Sysprep modifies the host SID. Some applications may not behave properly, like the Linbox Secure Control module (LSC). In that case, you need to run a script during the "sysprep" to update the LSC SSH server SID, by using the following instructions: In 'C:\Sysprep\$oem$', create a file named 'Cmdlines.txt' which contains: [Commands]
"C:\Progra~1\OpenSSH\bin\mkpasswd.bat"
Then run sysprep.exe, as shown above. The script which updates the SID will be run at the end of sysprep. |
Usually post-installation scripts are run during a restoration, so the first step is to activate the execution of those scripts for backups. Edit the file /tftpboot/revoboot/imgbase/Backup-B and Backup-L, and add " revopost" to the end of the 3rd line.
Now you can create a script which will be used by all the clients in /tftpboot/revoboot/images/postinst.
The following script first checks that it is less than 7am, and then checks that the system is not in restore mode, and shuts down the client :
if [ `date +%H` -lt 7 ]
then
if ! grep revorestore /etc/cmdline
then
halt
fi
fi
Post-installation scripts can be tested on any Linux Operating System or with Cygwin under Windows as the scripts are written in "shell", but, it is more interesting to put the finishing touches to your scripts directly on the client, by creating a post-installation script which will launch an interactive shell on the client:
Create a post-installation script which contains the line "sh </dev/console >/dev/console".
Assign the script to the client.
Add the "Post-installation" boot menu entry, and choose it.
You will get now a shell.
In that shell, you first have to load the post-installation library by typing " . /opt/lib/libpostinst.sh". Now, commands like "Mount 1", "RegistryAddString" are available. This shell has a simple editor built-in, "ae", which will allow you to edit client scripts by running "ae /revoinfo/MAC_ADDR/postinst" or "ae /revoinfo/templates/script". The script can then be run with " ./revoinfo/ADR_MAC/postinst" or " . /revoinfo/templates/script". You can also launch a telnet server by typing "inetd", to debug your scripts form another work station.
If you need to add your own functions to the library, we advise you to create a file called "mylibpostinst.sh" in /tftpboot/revoboot/lib/util/lib/ and to load it at the beginning of you post-installation script with a ". /opt/lib/mylibpostinst.sh", because the "libpostinst.sh" file will be overwritten by each LRS update.
Individual client post-installation logs are available in "/tftpboot/revoboot/images/MAC_ADDR/postinst.log".


