.
Manucomp Systems
Hours of Operation

Monday to Friday:
9am - 6pm EST

Saturday & Sunday:
Closed

If you would like additional information please contact us toll-free at :

1-866-440-1115
info@manucomp.com

Can't find the product you are looking for?
Request a quote.
Custom Start Scripts
Back to Sun Tips

Custom Start Scripts


One use that the Advanced Installation Guide suggests for begin scripts would be to backup files from the client to some other location. That would involve NFS mounting the server to the client and copying over the relevant files before the install or upgrade.

The most interesting use for begin scripts, however, is to generate so-called derived profiles. The idea behind derived profiles is that the server will probe the client to determine variables such as disk size and memory size, and automatically develop an appropriate profile based on whatever guidelines you have specified in your begin script. For example, you can write a script that would tell Jumpstart: "use the cluster SUNWreq if the client has a small root disk, otherwise use the cluster SUNWuser" or "determine the swap size based on the amount of physical RAM on the client."

Some of the variables that you can use are SI_MEMSIZE (the amount of memory), SI_ROOTDISK (the rootdisk, selected according to the formula of any disk that contains the preinstalled Solaris boot image, then the disk c0t3d0s0, and finally the first available disk), and SI_ROOTDISKSIZE. Remember that you must use the rules file to probe for the associated values in order to use each of these variables. The following rules section would allow us to probe for variables related to disksize and memsize, while matching practically any system:

! disksize c0t0d0s0 0-100 && \

disksize rootdisk 100-40000 && \

memsize 32-8096 \

custom.begin = local.finish

Note the "=" sign where the profile name would normally be located. That is the key to using derived profiles. The "=" sign basically tells JumpStart: "we do not have a profile for you yet, but our begin script will define one called SI_PROFILE." Accordingly, your begin script should reference the variables that you want to check, use the values to define your profile, and then send the output to SI_PROFILE. Below is one of my own custom begin scripts, based loosely on some of the suggestions above:

#!/bin/sh
#
# custom.begin 03/19/01 JRA
#
# The custom.begin script uses values that we have probed
# from the client system to setup a so-called derived
# profile that is unique to each client system, based on
# disk size and memory.
#
# Print the values that we have detected
#
echo "Physical memory detected: ${SI_MEMSIZE}"
echo "Root disk detected: ${SI_ROOTDISK}"
echo "Root disk size detected: ${SI_ROOTDISKSIZE}"
sleep 5
#
# We need a minimum of 2 GB root disk
#
if [ ${SI_ROOTDISKSIZE} -lt 2048 ]
then
echo "Root disk smaller than 2048 MB. Exiting..."
exit
fi
#
# Calculate swap size
#
# We would like swap size to equal physical memory
#
SWAP_SIZE=${SI_MEMSIZE}
#
# But be sure to allow enough space for the root filesystem
#
if [ `expr ${SWAP_SIZE} + 1500` -gt ${SI_ROOTDISKSIZE} ]
then
SWAP_SIZE=`expr ${SI_ROOTDISKSIZE} - 1500`
fi
#
# The minimum allowed swap size is 384 MB
#
if [ ${SWAP_SIZE} -lt 384 ]
then
SWAP_SIZE=384
fi
echo "Swap size set to ${SWAP_SIZE}"
sleep 5
#
# Now define the swap partition based on the formula that
# the root partition will be cxtxdxs0 and that the swap
# partition will be cxtxdxs1.
#
SWAP_DISK=`echo "${SI_ROOTDISK}" | sed 's/0$/1/'`
echo "Swap partition will be ${SWAP_DISK}"
sleep 5
#
# Now we can create the profile based on these values
#
echo "install_type initial_install" > ${SI_PROFILE}
echo "system_type standalone" >> ${SI_PROFILE}
echo "partitioning explicit" >> ${SI_PROFILE}
echo "filesys ${SI_ROOTDISK} free /" >> ${SI_PROFILE}
echo "filesys ${SWAP_DISK} ${SWAP_SIZE} swap" >> \
${SI_PROFILE}
echo "cluster SUNWuser" >> ${SI_PROFILE}
echo "package SUNWtcsh add" >> ${SI_PROFILE}

(I use the "sleep" statements to render the output more readable during the install process.)

Be careful how you create your derived profile, since the check script will not be able to verify that it is correct. (It will simply see the "=" sign and assume that you know what you are doing).