Jumpstart finish scripts

2007-12-25 9:29:00

Thanks to all that responded, the first reply only took 20 mins.

My original question was:-

Is it possible to install the recommended patch clusters, as part of the

finish script ?

The problem I can see is that the actual bootdisk is mounted on /a

during the jumpstart installation, so any pathnames in the patches will

be incorrect.

Is it possible to tell install_cluster the / mount point, or do I need

to write a script that gets copied into /etc/rc2.d that installs the

patches the first time it reboots on completion of the installation.

Thanks to:-

jmmosley@uncc.edu James M Mosley

kmpoon@eee.hku.hk Kai Ming Poon

prylons@air.dec.state.ny.us Paul Lyons

jefi@kat.ina.de Jens Fischer

bruce.cross@tti.fingerhut.com Bruce Cross

eric.walters@sdrc.com Eric Walters

Ken.Picard@ska.com Ken Picard

vm18276@cae902.tu.hac.com Bill Campillo

grm@star.le.ac.uk Geoff Mellor

brain.styles@mrc-bsu.cam.ac.uk Brain Styles

tkld@cogsci.ed.ac.uk Kevin Davidson

Matthew.Stier@mci.com Matthew Stier

ian.camm@sse.eu.sony.co.jp Ian Camm

Answers:-

The majority seemed to favour using a script that installed the patches

during the first boot after the jumpstart installation. I've included

some of the supplied scripts below:

INSTALLHOST="master"

mkdir /a/added_patches

# Note the following is all one line

mount -F nfs

${INSTALLHOST}:/export/install_2.5.1/auto_install_encon/added_patches

/a/added_patches

# SUGGESTED PATCHES

# Note the -R /a tells the script to use /a as the effective root

directory for the command.

/bin/echo "\nInstalling Suggested Patches\n"

cd /a/added_patches/suggested

echo "Current Directory=`pwd`"

for i in *

do

   /bin/echo "\nInstalling Suggested Patch $i\n"

   /a/added_patches/installpatch -R /a -d /a/added_patches/suggested/$i

done

-------------------------------------------------------------------------

---------------------------------------

----------------------------------------------------------

This is ran within the finish script :

#!/bin/sh -x

#

# ...put the rc script for patches in place

#

#####

#

# Get IP of the appropriate port on the jumpstart server

#

IP_OF_JUMPSTART_SERVER="`mount|grep ${SI_CONFIG_DIR}|head -1|cut -d:

-f1|awk

'{print $3}'`"

sed -e "s/IP_OF_JUMPSTART_SERVER/$IP_OF_JUMPSTART_SERVER/g" \

                ${SI_CONFIG_DIR}/extra_files/S99patches >

/a/etc/rc3.d/S99patches

chmod 755 /a/etc/rc3.d/S99patches

----------------------------------------------------------

"S99patches" :

#!/bin/sh

#################################################################

PATH=/usr/bin:/usr/sbin:/etc

OS=`uname -r`

#################################################################

# Figure out which server to mount

#################################################################

PATCHSERVER="IP_OF_JUMPSTART_SERVER"

#################################################################

# Mount the patch server

#################################################################

mkdir -p /patch

mount $PATCHSERVER:/export2/patches /patch

#################################################################

# Run the installpatch program

#################################################################

/patch/install_patch

#################################################################

# Remove myself

#################################################################

rm $0

#################################################################

# Reboot with "-r" option for good measure

#################################################################

reboot -- -r

-----------------------------------------------------------------------

"install_patch" (in /export2/patches) :

#!/bin/ksh

###################################################################

LOGFILE=/var/adm/install_patch.log

OS=`uname -r`

PATCHDIR="/net/JUMPSTARTSERVER.DOMAIN/export2/patches"

###################################################################

# Move old log file to .old if it exists

###################################################################

if [ -a $LOGFILE ]

then

        mv $LOGFILE $LOGFILE.old

fi

###################################################################

# Set the "data" file(contains list of patches to be installed)

###################################################################

if [ -z "$1" ]

then

        DATA=$PATCHDIR/data/mandatory_${OS}_patches

else

        DATA=$PATCHDIR/data/$1

fi

###################################################################

# Check to make sure data file is readable and exists

###################################################################

if [ ! -r "$DATA" ]

then

        echo "Datafile($DATA) is not readable" | tee -a $LOGFILE

        exit 1

fi

###################################################################

# Actually install patches

###################################################################

for PATCH in `cat $DATA | cut -d\| -f1`

do

        echo "Installing patch $PATCH for SunOS $OS" | tee -a $LOGFILE

        $PATCHDIR/patches_$OS/$PATCH/installpatch -u -d \

                $PATCHDIR/patches_$OS/$PATCH >> $LOGFILE 2>&1

        echo "--------------------------------------" >> $LOGFILE

done

###################################################################

# List installed patches

###################################################################

echo "\nThe following patches are installed on the system:" | tee -a

$LOGFILE

$PATCHDIR/patches_$OS/$PATCH/installpatch -p | tee -a $LOGFILE

###################################################################

# Get rid of /var/sadm/patch for / space considerations

###################################################################

rm -rf /var/sadm/patch >/dev/null 2>&1

###################################################################

# Tell user to reboot

###################################################################

echo "Please reboot system for patches to take affect"

-----------------------------------------------------------------

#/bin/sh

#add_patch.fin

B=/a #base directory of all absolute paths

PATCH_SERV=cyclops:/5_4patches

mkdir $B/patches

mount -F nfs ${PATCH_SERV} $B/patches

if [ $? = 0 ]

then

        cd $B/patches

        for patch in `ls $B/patches`

        do

                if [ -x $B/patches/${patch}*/installpatch ]

                then

                        echo "

==============================

Applying patch ${patch}

=============================="

        /usr/sbin/chroot $B /patches/`ls -d ${patch}*`/installpatch \

        /patches/`ls -d ${patche}*`

                        rm -r $B/var/sadm/patch/${patch}*/save

        

                else

                        echo "

==============================

Error: Patch $patch not added.

=============================="

                fi

        done

        cd

        umount $B/patches

        rmdir $B/patches

else

        rmdir $B/patches

        echo "

=====================================

Error: Cannot mount patch directory.

       Patches not added

=====================================

fi

Comments

Got something to say?

You must be logged in to post a comment.