home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 204.img / SC386BN1.TD0 / etc / install < prev    next >
Encoding:
Text File  |  1987-05-26  |  2.1 KB  |  99 lines

  1. :
  2. #    @(#) install.sh 1.1 86/12/18 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1985.
  5. #    This Module contains Proprietary Information of
  6. #    The Santa Cruz Operation, Microsoft Corporation
  7. #    and AT&T, and should be treated as Confidential.
  8. #
  9. #
  10. #  Xenix System V installation program 
  11. #
  12.  
  13. PATH=/bin:/usr/bin:/etc
  14.  
  15. # Return values for /etc/firsttime or anyone who cares
  16. : ${OK=0} ${FAIL=1} ${STOP=10} ${HALT=11}
  17.  
  18. # Prompt for yes or no answer - returns non-zero for no
  19. getyn='(while    read yn
  20.     do    case "$yn" in
  21.         [yY])    exit 0                 ;;
  22.         [nN])    exit 1                ;;
  23.         *)    echo "Please answer y or n" >&2    ;;
  24.         esac
  25.     done)'
  26.  
  27. cd /
  28. umask 0
  29.  
  30. # If we have a no valid device argument, default to /dev/install 
  31. DEVICE=/dev/install
  32.  
  33. case $1 in
  34. /dev/*)    if [ -b $1 -o -c $1 ]
  35.     then
  36.         DEVICE=$1
  37.         shift
  38.     else
  39.         echo "$0: invalid device argument $1" >&2
  40.         exit $FAIL
  41.     fi
  42. esac
  43.  
  44. echo "
  45. For each volume in the distribution set, insert the
  46. floppy into the drive, enter 'y', and press <RETURN>.
  47. Enter the letter 'n' after the last volume.
  48.  
  49. Should you see the message 'tar: please mount new volume.',
  50. insert the next floppy, and press <RETURN>.\n"
  51.  
  52. # Remove initialization scripts before we start,
  53. #    and on shell interruption.
  54.  
  55. [ -x /bin/rm ] && rm -f ./once/init.* ./tmp/init.*
  56. trap 'rm -f ./once/init.* ./tmp/init.*; exit $FAIL' 1 2 3 15
  57.  
  58. WHICH=First
  59. while    echo "\n$WHICH Floppy? (y/n) \c" >&2
  60.     read x
  61. do    case $x in
  62.     n|N)    case $WHICH in
  63.         First)    echo "\nAborting installation procedure.\n" >&2
  64.             exit $FAIL
  65.             ;;
  66.         Next)    break
  67.             ;;
  68.         esac
  69.         ;;
  70.  
  71.     y|Y)    echo "Extracting files ..." >&2
  72.         until    tar xf $DEVICE
  73.         do    echo "Extraction error: try again? (y/n) \c" >&2
  74.             eval "$getyn" && continue
  75.             echo "Continue with the installation? (y/n) \c" >&2
  76.             eval "$getyn" && break
  77.             exit $FAIL
  78.         done
  79.         for script in ./once/init.* ./tmp/init.*
  80.         do    [ -x $script ] || continue
  81.             $script
  82.             case $? in
  83.             $OK)    : All is well            ;;
  84.             $STOP)    rm -f $script; exit $STOP    ;;
  85.             $HALT)    rm -f $script; /etc/haltsys    ;;
  86.             $FAIL)    echo "Error: $script failed" >&2;;
  87.             esac
  88.             rm -f $script
  89.         done
  90.         WHICH=Next
  91.         ;;
  92.  
  93.     *)    echo "\nEnter either 'y' or 'n'." >&2
  94.         ;;
  95.     esac
  96. done
  97. echo \\n${*:+"$* "}"Installation Complete.\n" >&2
  98. exit $OK
  99.