Auto Install for Mandrake Linux
Prev Next

postInstall and postInstallNonRooted

This option provides the installer two simple methods for performing post installation activities on the installed system. You can use one or the other or both methods. If you want to use both, then the installer will execute the 'postInstallNonRooted' first, then the 'postInstall' last.

postInstall:

'postInstall' => "

echo \"This is a test string\" > /root/test.log

"

For this option, the install script is executed as root on the target computer with the environment set to that of the target computer. In other words, any references to the file system are relative to the target computers / (root). In addition, DrakX executes the script that you define using the form: chroot /mnt bash -c <yourscript here> (/mnt is the directory, in the DrakX environment, under which the entire file system for the target computer is located).

postInstallNonRooted:

'postInstallNonRooted' => '

echo "This is a test string" > /mnt/root/test.log

'

For this option, the install script is executed within the current environment of the DrakX install program. In other words, any references to the file system are relative to DrakX's / (root). In addition, DrakX executes the script that you define using the form: bash -c <yourscript here>.

The above two examples produce the exact same result; the string, This is a test string is placed in a file called test.log located in the /root directory on the target computer. For the observant, there are a some other subtle differences. The use of a perl single-quote string literal (which allows only the \' and \\ escape-sequences) and the perl double-quote string literal (which allows backslash and variable interpolation). Either form can be used with either option, although the single-quote form is the easiest to follow and likely the most often used. In the double-quote form, the double-quote (") before and after the string This is a test string had to be 'escaped', otherwise the script would have terminated prematurely and as a consequence not be executed.

Examples:

The following are a simple set of examples which demonstrate the use of these options.

Change the default auto install run level from 5 to 3 (uses "" so that the sed parameter does not have to be 'escaped'):

'postInstall' => "

# change run level from 5 to 3

cat /etc/inittab | sed 's/^id:5:init/id:3:init/' > /etc/inittab1

mv -f /etc/inittab1 /etc/inittab

"

Or using a simple perl one-liner:

'postInstall' => '

# change run level from 5 to 3

perl -p -i -e "s/^id:5:init/id:3:init/" /etc/inittab

'

Copy the auto install configuration file defined with the syslinux.cfg append parameter auto_install= to the target computers /root/drakx directory (this only works for NFS and CD-ROM source medias):

'postInstallNonRooted' => "

# copy the file from the source media

cp /tmp/image/$::auto_install /mnt/root/drakx/

"

A little more complicated variation:

'postInstall' => '

# only if the NTP package is installed

if [ -f /etc/ntp.conf ]; then

cat <<EOF1 > /etc/ntp/step-tickers

time-server.eastcott.net

EOF1

fi


# clean up bug for Netscape

cat <<EOF2 >> /etc/skel/.bash_profile


# clean up old cache files, since Netscape doesn't

[ -d ~/.netscape ] && rm -rf ~/.netscape/cache/*


EOF2

'



The EOF (or what you used for <<EOF) MUST begin in column 1 and be on a line by itself.

One final note, if you selected 'autoExitInstall' => 0, then these two options do NOT get executed until AFTER you press the ENTER key at the end of the installation process.

Related Option Entries:

Depends on what all you installed.




PrevHome Next
partitions   printer