Creating start/finish scripts for Solaris JumpStart installations

One of my earlier posts dealt with the installation of a Solaris JumpStart server. However, I have since been asked to publish some details on the use of start/finish scripts (a means by which you can further tailor the JumpStart process). so, here they are:

What are Start/Finish scripts?

In my understanding, a start script is any executable script file (in any supported language) that will be executed prior to the commencement of the Solaris JumpStart installation on a given system. A finish script is any executable script file (in any supported language) that shall be executed just after the Solaris JumpStart installation has completed but before the system is formally rebooted. Personally, I have only ever used finish scripts and did so to automate the installation of certain SUN packages as well as the creation of certain user accounts and directories.

/export/jumpstart/rules

My original post showed a rules file entry which looked something like this:

network XX.XX.XX.0 && arch sparc - myT1000 -

In this instance, there are no start or finish scripts being used (as indicated by the hyphens on either side of the profile name, myT1000). To specify a finish script change the above entry to look like this:

network XX.XX.XX.0 && arch sparc - myT1000 myFinish.sh

Don’t forget to re-run the check program after you update the rules file (/export/install/check)

/export/install/myFinish.sh

An important thing to note about the Solaris JumpStart process is that, prior to the final reboot of the (new) system, the root file system of the new system will be mounted on /a and will remain there until the system performs its final reboot. So, when creating a finish script, you must bear this in mind and alter you finish script accordingly. Aside from this, the finish script uses tools and techniques used by most Solaris administrators (well, mine does anyway) with some notable exceptions. Please Note that I have deliberately omitted certain instructions for security reasons (but you should get the idea in any case):

Script Setup

BASE=/a
MNT=$BASE/mnt
GROUPS_FILE=$BASE/etc/group
PASSWD_FILE=$BASE/etc/passwd

Creating Groups and Users

As I recall, it was a bit tricky to automate this so I went with the following solution:

echo "Creating Groups ..." | tee -a $INSTALL_LOG
echo "$GRP_MYSQL::$GID_MYSQL:" >> $GROUPS_FILE
echo "Creating Users ..." | tee -a $INSTALL_LOG
echo "$USR_MYSQL:x:$UID_MYSQL:$GID_MYSQL::/home/$USR_MYSQL:/dev/null" >> $PASSWD_FILE

Creating Directories

echo "Creating Directories ..." | tee -a $INSTALL_LOG
EXTRA_DIRS="$MNT/media $BASE/storage $BASE/export/zones"
for d in $EXTRA_DIRS
do
if [ ! -d $d ]; then
echo "Creating $d ..." | tee -a $INSTALL_LOG
mkdir -p $d >> $INSTALL_LOG 2>&1
fi
done

Installing Additional Packages

This can be a little tricky as it requires the creation of a package administration file (new to me) in order to automatically install packages. Also, the packages I wanted to install were located on another NFS server

PKG_ADMIN=$BASE/tmp/admin
PKG_REPO=xxxx:/export/install/pkgs
echo "Configuring additional software ..." | tee -a $INSTALL_LOG
mount -F nfs $PKG_REPO $MNT >> $INSTALL_LOG 2>&1
cat > $PKG_ADMIN <
mail=root
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=ask
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default
DONT_ASK

echo “Installing MySQL …” | tee -a $INSTALL_LOG
pkgadd -n -a $PKG_ADMIN -R $BASE -d $MNT/CSKmysql_sparc.pkg all >> $INSTALL_LOG 2>&1

umount $MNT >> $INSTALL_LOG 2>&1

Clearly, the above snippets will not work out of the box for you. However, they should give you a good starting point.

Reference Sites


Leave a Reply