home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nsu / install / request < prev    next >
Text File  |  1998-08-19  |  6KB  |  217 lines

  1. #ident    "@(#)request    1.2"
  2. #ident    "$Header: $"
  3.  
  4. #    request script for nsu package installation
  5.  
  6. trap 'exit 3' 15
  7.  
  8. #
  9. #  Make sure LOCALE environment variable is set.  If it's not set
  10. #  coming in to this request script, then default to the C-locale.
  11. #
  12. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  13.  
  14. UPINSTALL=/etc/conf.sav
  15. SCRIPTS=/usr/sbin/pkginst
  16. UPGRADE_STORE=/etc/inst/save.user
  17. UPGFILE=${UPGRADE_STORE}/${PKGINST}.env
  18.  
  19. . $SCRIPTS/updebug
  20.  
  21. [ "$UPDEBUG" = "YES" ] && {
  22.     set -x
  23.     goany
  24. }
  25.  
  26. OUTPUT=$1
  27. > ${OUTPUT}
  28.  
  29. CLASSES="none" export CLASSES
  30.  
  31. # Since the new mtune.d/ptm is not installed yet, we get the number
  32. # of default pseudo-ttys from the pkginfo file. 
  33. NREG=$DFLT_REG
  34.  
  35. MENU_DIR=/etc/inst/locale/${LOCALE}/menus/${PKG}
  36. [ -d ${MENU_DIR} ] || mkdir -p ${MENU_DIR}
  37.  
  38. MENUS="menu.nsu"
  39.  
  40. for i in $MENUS
  41. do
  42.    if [ ! -f ${MENU_DIR}/$i ]
  43.    then
  44.       if [ -f ${REQDIR}/inst/locale/${LOCALE}/${PKG}/$i ]
  45.       then
  46.            cp ${REQDIR}/inst/locale/${LOCALE}/${PKG}/$i ${MENU_DIR}
  47.       else
  48.            cp ${REQDIR}/${PKG}/$i ${MENU_DIR}
  49.       fi
  50.    fi
  51. done
  52. #
  53. #  Set up to use menu_colors; default to C-locale if ${LOCALE}'s dir has
  54. #  no menu_colors.sh
  55. #
  56. if [ -f /etc/inst/locale/${LOCALE}/menus/menu_colors.sh ]
  57. then
  58.     . /etc/inst/locale/${LOCALE}/menus/menu_colors.sh
  59. else
  60.     . /etc/inst/locale/C/menus/menu_colors.sh
  61. fi
  62.  
  63. ############# Begin UPGRADE AND OVERLAY #######################
  64.  
  65. export INSTALL_MODE PKGINSTALL_TYPE AUTOMERGE
  66.  
  67. #  set INSTALL_MODE to CUSTOM, if not set
  68.  
  69. [ "$INSTALL_MODE" ] || INSTALL_MODE=CUSTOM
  70.  
  71. AUTOMERGE=NULL
  72. PKGINSTALL_TYPE=NEWINSTALL
  73.  
  74. [ "$UPDEBUG" = "YES" ] && goany
  75.  
  76. # Call chkpkgrel to determine installation type. As a side-effect, 
  77. # chkpkgrel will make $UPGFILE.
  78. ${SCRIPTS}/chkpkgrel
  79. PKGVERSION=$?
  80.  
  81. case $PKGVERSION in
  82.     2)    PKGINSTALL_TYPE=OVERLAY    ;;
  83.     4)    PKGINSTALL_TYPE=UPGRADE    ;;
  84.     6)    PKGINSTALL_TYPE=UPGRADE2    ;;
  85.     *)    ;;
  86. esac
  87.  
  88. [ "$PKGINSTALL_TYPE" = NEWINSTALL ] || {
  89.  
  90.     AUTOMERGE=Yes
  91.  
  92.     # Determine number of pseudo-ttys to configure.     
  93.     # This is the number previously configured
  94.     # or the default which ever is greater. In UnixWare 2.0
  95.     # the default was significantly increased. We will
  96.     # allocate at least this new default amount.
  97.  
  98.     # For upgrades from pre-UnixWare 2.0 releases, the number of
  99.     # regular ptys can be found in the sdevice.d/ptm file.
  100.     # Pre-UnixWare 2.0 releases had different drivers and, consequently,
  101.     # different sdevice.d files for SCO and regular ptys. They 
  102.     # did not have tuneables for ptys so idtune cannot be used.
  103.  
  104.     # For an overlay using pkgadd, the request (and preinstall)
  105.     # script can use idtune to get the number of ptys since 
  106.     # the old /etc/conf files are still available.
  107.  
  108.     # Overlays from the boot floppy are more complicated.
  109.     # Since one driver handles both SCO and regular ptys,
  110.     # the sdevice.d/ptm file has the sum of both types. To find
  111.     # the number of regular, count the lines for regular ptys in
  112.     # the $UPINSTALL/node.d/pts file. 
  113.  
  114.     # Note that for boot-floppy installations, the contents of the
  115.     # /etc/conf directory are saved in conf.sav. Since request
  116.     # scripts are not run on the boot-floppy, only the preinstall
  117.     # needs to use conf.sav. 
  118.  
  119.     # There is one odd case - when a boot-floppy upgrade or overlay
  120.     # is done with nsu installed but not selected from the package
  121.     # selection menu.  No /etc/conf files for nsu are available 
  122.     # when pkgadd is used to upgrade or overlay it on the running system.
  123.     # In this case, just set the number of pty's to the defaults.
  124.  
  125.  
  126.     [ "$PKGINSTALL_TYPE" = UPGRADE ] && {
  127.         if [ -f /etc/inst/scripts/postreboot.sh ]
  128.         then
  129.         # We are installing from the boot floppy.
  130.         # (We checked for boot-floppy installation just in case
  131.         # at some future time the request script is called from
  132.         # the boot-floppy. The extra cost is small.)
  133.             PTM=$UPINSTALL
  134.         else
  135.             PTM=/etc/conf
  136.         fi    
  137.         
  138.         # We are upgrading from a pre-UnixWare 2.0 release that used 
  139.         # different drivers for SCO and regular ptys. The sdevice.d/ptm 
  140.         # file will have only the number of regular ptys.
  141.         if [ -f $PTM/sdevice.d/ptm ]
  142.         then
  143.             grep "^ptm    " $PTM/sdevice.d/ptm >/tmp/ptm.$$ 2>/dev/null
  144.             OFS=$IFS
  145.             IFS="    "    #tab
  146.             read Dev Conf LAST_REG x4 </tmp/ptm.$$
  147.             [ "$Conf" = N ] && LAST_REG=$DFLT_REG
  148.             IFS=$OFS
  149.             rm -f /tmp/ptm.$$
  150.  
  151.             [ "$LAST_REG" -gt "$DFLT_REG" ] && NREG=$LAST_REG
  152.             [ "$NREG" -gt "$MAX_REG_PTS" ] && NREG=$MAX_REG_PTS
  153.         else
  154.         # This is the odd case when we cannot find the old values. 
  155.         # Use the defaults.
  156.                 continue
  157.         fi
  158.     }
  159.  
  160.     [ "$PKGINSTALL_TYPE" = OVERLAY -o "$PKGINSTALL_TYPE" = UPGRADE2 ] && {
  161.         if [ -f /etc/inst/scripts/postreboot.sh ]
  162.         then
  163.         # We are installing from the boot floppy.
  164.         # (We checked for boot-floppy installation just in case
  165.         # at some future time the request script is called from
  166.         # the boot-floppy. The extra cost is small.)
  167.             PTM=$UPINSTALL
  168.             NREG=`cut -f2 $PTM/node.d/pts|grep pts|wc -l`
  169.             [ "$NREG" -gt "$MAX_REG_PTS" ] && NREG=$MAX_REG_PTS
  170.         else
  171.         # We are installing using pkgadd on a running system.
  172.             PTM=/etc/conf
  173.             if [ -f $PTM/mtune.d/ptm ]
  174.             then
  175.                 line=`/etc/conf/bin/idtune -g NUMREGPT`
  176.                 set - $line
  177.                 NREG=$1
  178.                 [ "$NREG" -gt "$MAX_REG_PTS" ] && NREG=$MAX_REG_PTS
  179.             else
  180.             # This is the odd case when we cannot find the old values.
  181.             # Use the defaults.
  182.                 continue
  183.             fi    
  184.         fi
  185.     }
  186. }
  187.  
  188. ############# End UPGRADE AND OVERLAY #######################
  189. # export NREG for use by menu command
  190. export NREG
  191.  
  192. # Show the menu only if we are not installing from the boot-floppy.
  193. [ ! -f /etc/inst/scripts/postreboot.sh ] && {
  194.     menu_colors regular
  195.     > /tmp/out
  196.     
  197.     menu -f $MENU_DIR/menu.nsu -o /tmp/out 2> /dev/null
  198.     . /tmp/out
  199. }
  200.  
  201. echo "CLASSES=\"${CLASSES}\"" >> $OUTPUT
  202.  
  203. #echo "NREG=$NREG" >>$OUTPUT || exit 1
  204.  
  205. echo AUTOMERGE=\"${AUTOMERGE}\" >> ${OUTPUT}
  206. echo PKGINSTALL_TYPE=\"${PKGINSTALL_TYPE}\" >> ${OUTPUT}
  207. echo INSTALL_MODE=\"${INSTALL_MODE}\" >> ${OUTPUT}
  208.  
  209. # Now a kludge, since the boot-flpppy does not run the request script
  210. # but does make an $UPGFILE, we need another flag to tell preinstall
  211. # that this request script was run. Put $NREG into $UPGFILE as the flag.
  212. # We have to empty out the contents first since chkpkgrel puts in value
  213. # of $PKGVERSION which gives an error when $UPGFILE is dotted in later.
  214. echo "NREG=$NREG" >$UPGFILE
  215.  
  216. exit 0
  217.