: /bin/sh # Master upgrade script curdir=`pwd` #/* #** $Header: /u/catcom/scripts/src/RCS/t21install,v 1.3 97/04/02 12:45:21 catcom Exp $ #** $Author: catcom $ #** $Date: 97/04/02 12:45:21 $ #** $Locker: $ #*/ # default device DEFDEV="/dev/rfd0" # Define return values : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11} # clear the screen if it is supported clearscr() { # check if the terminal environment is set up [ "$TERM" ] && clear 2> /dev/null } # Prompt for no or yes answer - returns non-zero for yes getny() { while echo "\n$* (y/n) \c">&2 do read yn rest case $yn in [yY]) return $FAIL ;; [nN]) return $OK ;; *) echo "Please answer y or n" >&2 ;; esac done } # Prompt with mesg, return non-zero on q. Also allows setting -x and +x, # shell escapes and the passing of default values prompt() { mesg=$1 while echo "\n${mesg} or q to quit: \c" >&2 do read cmd case $cmd in +x|-x) set $cmd ;; -v) # Print the values of requested variables read x for var in $x do eval echo \$$var done ;; Q|q) return $FAIL ;; !*) eval `expr "$cmd" : "!\(.*\)"` ;; "") # If there is a second argument use it # as the default, else loop until 'cmd' is set [ "$2" ] && { cmd=$2 return $OK } : continue ;; *) return $OK ;; esac done } # main ############################# # Must be root to do the install if [ `id | cut -c5-5` != "0" ] then echo ERROR: Must be root to install exit 1 fi # change to the work directory cd /tmp # make sure ALL file systems are mounted /etc/mountall # ask for the tape, and insure thay have a formatted tape in the drive. #echo "\nPlease insert volume 1 [default: $DEFDEV] :\c" #read inputfile #if [ -z "$inputfile" ]; then # inputfile="$DEFDEV" #fi inputfile=${curdir}/$1 # remove any old upgrade files rm -f t21upg rm -f t21upg.Z #remove old install script rm -f /tmp/INSTALL cpio -ivcBmud -I $inputfile # handle compress upgrade or install if [ -f t21upg.Z ]; then uncompress t21upg.Z cpio -ivcBmud -I t21upg fi # run the release install script /tmp/INSTALL # cleanup rm -f t21upg rm -f t21upg.Z # Check install is OK. desfile=`grep "\.des$" /tmp/INSTALL | cut -d " " -f3 | uniq | sed -e "s/\.des//` # exit without checking description if desfile not in /tmp/INSTALL if [ -z "$desfile" ]; then exit 0 fi echo "Release description file [$desfile]" if /u/catcom/scripts/chkreldes $desfile; then banner "OK" else banner "Failed" fi echo "Hit Enter to continue." read x # all done. exit 0 #/* #** $Log: t21install,v $ # Revision 1.3 97/04/02 12:45:21 catcom # added path to chkreldes program # # Revision 1.2 96/10/11 14:57:13 catcom # changed default dev to /dev/rfd0 # # Revision 1.1 96/10/11 11:56:22 catcom # Initial revision # # Revision 1.1 96/04/23 15:19:18 root # Initial revision # # Revision 1.2 95/03/30 14:07:14 catcom # changed default device to /dev/rStp0 # # Revision 1.1 95/03/23 17:30:51 catcom # Initial revision # # Revision 1.4 92/09/17 12:57:08 catcom # fixed the rm's # # Revision 1.3 92/09/17 11:38:41 catcom # fix bug in test for blank inputfile # # Revision 1.2 92/09/17 10:58:26 catcom # added cpio on compressed file so that upgrades can be loaded from files # or devices # # Revision 1.1 92/09/16 16:02:04 root # Initial revision # # Revision 1.4 92/07/28 13:51:09 catcom # added /etc path to mountall # # Revision 1.3 92/07/21 10:49:20 catcom # modified to prompt for reboot at end # #** $Revision: 1.3 $ #** $Source: /u/catcom/scripts/src/RCS/t21install,v $ #** $State: Exp $ #*/