#!/bin/sh # mkuber Version 2.2.2 if [ "$1" = "" -o "$2" = "" ]; then echo "MakeUberJS v2.2.2" echo "Syntax: mkuber {PathToPutCDWorkingDir} {Standard/Server}" echo "" echo "mkuber will extract all of the slices on the Solaris CD (which must be inserted in the drive)" echo "to the directory you specify (best if its empty). It then downloads the needed files from" echo "the UberJS website." echo "" echo "There are still more files you will need to create following this, but the basics are put in place" echo "" echo "If you are making an UberJS Server CD, you must have an UberJS Standard Working dir already created because the" echo "UberJS Standard CD Root is sent to the booting client" echo "" echo "Please note, this program needs to run wget. When it does so, it will download the rcS and sysidfind scripts" echo "from the UberJS website. Those scripts may or may not be version dependant. As of the writing of this script" echo "they are built from Solaris 9 - 08/03 Release. Check your Solaris release." echo "" echo "If the releases differ, before you run this script with arguments, comment out the wget lines for rcS and sysidfind" echo "and manually edit those files as per the UberJS documentation on the website to avoid any possible differences" echo "in versions being obliterated accidentally." echo "" exit fi if [ ! -d $1 ]; then echo "$1 is not a directory or doesn't exist" exit fi if [ "$2" != "Standard" -a "$2" != "Server" ]; then echo "Argument 2 must be either Standard or Server" exit fi if [ "$LOGNAME" != "root" ]; then echo "Must be root (needed to run mount)" exit fi if [ ! -d /cdrom/cdrom0/s0/Solaris_9 ]; then echo "Please insert Solaris 9 CD and run this script again" exit fi echo "" echo "MakeUberJS v2.2.2 running" echo "" echo "Using specified directory $1" echo "Extracting Slice 0" mkdir /$1/s0 CPWD=`pwd` # keep track of where we were cd /cdrom/cdrom0/s0 find . -print | grep -v Solaris_9/Product | cpio -pdmu /$1/s0 cd $CPWD # go back to where we came from echo "Stopping volume management" /etc/init.d/volmgt stop VOLD=`ps -ef | grep vold` while [ "$VOLD" != "" ]; do VOLD=`ps -ef | grep vold` # wait for vold to actually stop, it's not instant and the next step will fail if its not stopped done for SLICE in 1 2 3 4 5; do echo "Extracting slice ${SLICE}" dd if=/dev/dsk/c0t2d0s$SLICE of=/$1/sol9.s$SLICE bs=512 done echo "Starting volume management" cd / # start volmgt from / /etc/init.d/volmgt start cd $CPWD VOLD=`ps -ef | grep vold` while [ "$VOLD" = "" ]; do VOLD=`ps -ef | grep vold` # wait for vold to load done echo "Mounting slice 1 on /mnt" LOFIDEV=`lofiadm -a /$1/sol9.s1` mount $LOFIDEV /mnt echo "Making UberJS directory" mkdir /mnt/.tmp_proto/uberjs if [ "$2" = "Standard" ]; then echo "Getting latest Standard uberjs-exec from clue.eng.iastate.edu/uberjs/uberjs-standard" wget -q -nd -nH -P /mnt/.tmp_proto/uberjs http://clue.eng.iastate.edu/uberjs/uberjs-standard/uberjs-exec echo "Getting Standard rcS from clue.eng.iastate.edu/uberjs/uberjs-standard" wget -q -nd -nH -P /mnt/sbin http://clue.eng.iastate.edu/uberjs/uberjs-standard/0803rcS else echo "Getting latest Server uberjs-exec from clue.eng.iastate.edu/uberjs/uberjs-server" wget -q -nd -nH -P /mnt/.tmp_proto/uberjs http://clue.eng.iastate.edu/uberjs/uberjs-server/uberjs-server-exec echo "Getting latest 'Server Booted Client (SBC)' from clue.eng.iastate.edu/uberjs/uberjs-server" wget -q -nd -nH -P /mnt/.tmp_proto/uberjs http://clue.eng.iastate.edu/uberjs/uberjs-server/uberjs-SBC-exec echo "Getting Server rcS from clue.eng.iastate.edu/uberjs/uberjs-server" wget -q -nd -nH -P /mnt/sbin http://clue.eng.iastate.edu/uberjs/uberjs-server/0803rcS fi mv /mnt/sbin/0803rcS /mnt/sbin/rcS chmod a+x /mnt/sbin/rcS echo "Getting latest sysidfind from clue.eng.iastate.edu/uberjs/uberjs-standard" wget -q -nd -nH -P /mnt/sbin http://clue.eng.iastate.edu/uberjs/uberjs-standard/0803sysidfind mv /mnt/sbin/0803sysidfind /mnt/sbin/sysidfind chmod a+x /mnt/sbin/sysidfind echo "Getting latest mkiso from clue.eng.iastate.edu/uberjs/scripts" wget -q -nd -nH -P $1 http://clue.eng.iastate.edu/uberjs/scripts/mkiso chmod a+x /$1/mkiso echo "Getting wget from clue.eng.iastate.edu/uberjs/binaries" wget -q -nd -nH -P /mnt/.tmp_proto/uberjs http://clue.eng.iastate.edu/uberjs/binaries/wget chmod a+x /mnt/.tmp_proto/uberjs/wget echo "Touching disable_dial in /mnt/.tmp_proto/uberjs" touch /mnt/.tmp_proto/uberjs/disable_dial echo "Copy local resolv.conf to CD? [y/n]" read YESNO if [ "$YESNO" = "y" ]; then echo "Copying your resolv.conf to /mnt/.tmp_proto/root/etc" cp /etc/resolv.conf /mnt/.tmp_proto/root/etc fi echo "Use /mnt/etc/nsswitch.dns for nsswitch.conf on CD? [y/n]" read YESNO if [ "$YESNO" = "y" ]; then echo "Replacing /mnt/.tmp_proto/root/etc/nsswitch.conf with /mnt/etc/nsswitch.dns" cp /mnt/etc/nsswitch.dns /mnt/.tmp_proto/root/etc/nsswitch.conf fi if [ "$2" = "Server" ]; then echo "Making /mnt/.tftpboot_proto, /mnt/tftpboot, and /mnt/clientinfo" mkdir /mnt/.tftpboot_proto mkdir /mnt/tftpboot mkdir /mnt/clientinfo echo "Changing ownership and permissions for .tftpboot_proto, tftpboot, and clientinfo" chown root:sys /mnt/.tftpboot_proto chown root:sys /mnt/tftpboot chown root:sys /mnt/clientinfo chmod +t /mnt/tftpboot chmod +t /mnt/clientinfo chmod a+rwx /mnt/tftpboot chmod a+rwx /mnt/clientinfo echo "Linking /mnt/etc/bootparams to /mnt/tmp/root/etc/bootparams" ln -s ../tmp/root/etc/bootparams /mnt/etc/bootparams echo "Linking /mnt/etc/ethers to /mnt/tmp/root/etc/ethers" ln -s ../tmp/root/etc/ethers /mnt/etc/ethers echo "Moving /mnt/etc/inet/inetd.conf to /mnt/.tmp_proto/root/etc/inet" mv /mnt/etc/inet/inetd.conf /mnt/.tmp_proto/root/etc/inet echo "Linking /mnt/etc/inet/inetd.conf to /mnt/tmp/root/etc/inet/inetd.conf" ln -s ../../tmp/root/etc/inet/inetd.conf /mnt/etc/inet/inetd.conf echo "Making /mnt/.tmp_proto/root/etc/dfs" mkdir /mnt/.tmp_proto/root/etc/dfs echo "Moving /mnt/etc/dfs/* to /mnt/.tmp_proto/root/etc/dfs/" mv /mnt/etc/dfs/* /mnt/.tmp_proto/root/etc/dfs echo "Removing /mnt/etc/dfs" rmdir /mnt/etc/dfs echo "Linking /mnt/etc/dfs to /mnt/tmp/root/etc/dfs" ln -s ../tmp/root/etc/dfs /mnt/etc/dfs echo "Adding /clientinfo share to /mnt/.tmp_proto/root/etc/dfs/dfstab" echo "share -F nfs -o ro /clientinfo" >> /mnt/.tmp_proto/root/etc/dfs/dfstab echo "Copying /mnt/usr/platform/*/lib/fs/nfs/inetboot to /mnt/.tftboot_proto/inetboot.*" cp /mnt/usr/platform/sun4m/lib/fs/nfs/inetboot /mnt/.tftpboot_proto/inetboot.SUN4M cp /mnt/usr/platform/sun4u/lib/fs/nfs/inetboot /mnt/.tftpboot_proto/inetboot.SUN4U cp /mnt/usr/platform/sun4us/lib/fs/nfs/inetboot /mnt/.tftpboot_proto/inetboot.SUN4US echo "Copying s0/Solaris_9/Tools to /mnt/InstallTools" cp -R /$1/s0/Solaris_9/Tools /mnt >/dev/null 2>&1 mv /mnt/Tools /mnt/InstallTools echo "Getting uber-aic from http://clue.eng.iastate.edu/uberjs/uberjs-server/uber-aic" echo "and placing it in /mnt/InstallTools" wget -q -nd -nH -P /mnt/InstallTools http://clue.eng.iastate.edu/uberjs/uberjs-server/uber-aic chmod a+x /mnt/InstallTools/uber-aic echo "Getting assisted-aic from http://clue.eng.iastate.edu/uberjs/uberjs-server/assisted-aic" echo "and placing it in /mnt/InstallTools" wget -q -nd -nH -P /mnt/InstallTools http://clue.eng.iastate.edu/uberjs/uberjs-server/assisted-aic chmod a+x /mnt/InstallTools/assisted-aic fi echo "Unmounting Slice 1" cd $CPWD umount /mnt lofiadm -d $LOFIDEV echo "UberJS CD make complete" echo "" echo "This script has created only the necessary files for UberJS on your Solaris CD." echo "See the documentation for other configuration files to create/edit." echo "Then run mkiso JumpStart jumpstart.iso to create a JumpStart UberJS image" echo "once all configuration files are created." echo ""