Sample jumpstart "begin" script

Surprisingly, i couldnt find any example of a Solaris jumpstart "begin" script on the net, that is used to preserve old files, even though that is one of the purposes for them explicitly mentioned in the Sun docs. So I thought I should put one out there.

"begin" script, suitable for use in a "rules" file

#!/bin/sh
format /tmp/disk.list
ROOTDISK=`head -1 /tmp/disk.list`
ROOTFS=/dev/dsk/${ROOTDISK}s0
savekeys()
{
        cd /a
        echo Preserving ssh/kerb keys
        tar cvf /tmp/preserve.tar etc/ssh/*key* etc/krb5.keytab 2>/dev/null
        # If some or all files dont exist, tar will exit 1. thats ok.
        # if it creates an "empty" tarfile... thats ok too.
        cd /
}

if [ "`fstyp ${ROOTFS}`" = "ufs" ] ; then
        mount -F ufs -o ro ${ROOTFS} /a
        savekeys
        umount /a
fi

Things of note

It would be really nice to take advantage of something like $SI_ROOTDISK. Except for the fact that the variable does not seem to be defined (at least on Solaris 10 x86). Sigh. So that's why the hacky call to "format".

Matching "finish" script

#!/bin/sh

if test -f /tmp/preserve.tar ; then
        echo Extracting preserve.tar from old system
        (cd /a && tar xvfp - /tmp/preserve.tar)
fi


Written by: Philip Brown
Bolthole Top - Bolthole Solaris Top - Search Bolthole.com