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

  1. #ident    "@(#)pkg.acp:request    1.18.1.10"
  2. #ident    "$Header: $"
  3.  
  4. #    request script for acp package installation
  5.  
  6. trap 'exit 3' 15
  7.  
  8. CONFDIR=/etc/conf
  9. CONFBIN=${CONFDIR}/bin
  10.  
  11. #
  12. #  Make sure LOCALE environment variable is set.  If it's not set
  13. #  coming in to this request script, then default to the C-locale.
  14. #
  15. LOCALE=${LC_ALL:-${LC_MESSAGES:-${LANG:-"C"}}}
  16.  
  17. OUTPUT=$1
  18. >$OUTPUT
  19. # Since the new mtune.d/ptm is not installed yet, we get the number
  20. # of default pseudo-ttys from the pkginfo file. The default
  21. # we use depends on how many users are licensed.
  22. NUM_USERS=`keyadm -g USERS|cut -f1`
  23. if [ "$NUM_USERS" = "2" ]
  24. then
  25.     DFLT_SCO=$DFLT_SCO_PE
  26. else
  27.     DFLT_SCO=$DFLT_SCO_AS
  28. fi
  29. NSCO=$DFLT_SCO
  30.  
  31. ############# Begin  UPGRADE AND OVERLAY #######################
  32.  
  33. UPINSTALL=/etc/conf.sav
  34. SCRIPTS=/usr/sbin/pkginst
  35. UPGRADE_STORE=/etc/inst/save.user
  36. UPGFILE=${UPGRADE_STORE}/${PKGINST}.env
  37.  
  38. . ${SCRIPTS}/updebug
  39.  
  40. [ "$UPDEBUG" = YES ] && {
  41.     set -x
  42.     goany
  43. }
  44.  
  45.  
  46. export PKGINSTALL_TYPE INSTALL_MODE
  47.  
  48. #  set INSTALL_MODE to CUSTOM, if not set
  49.  
  50. [ "$INSTALL_MODE" ] || INSTALL_MODE=CUSTOM
  51.  
  52. AUTOMERGE=NULL
  53. PKGINSTALL_TYPE=NEWINSTALL
  54.  
  55. # Call chkpkgrel to determine installation type. As a side-effect,
  56. # it creates $UPGFILE.
  57. ${SCRIPTS}/chkpkgrel
  58. PKGVERSION=$?
  59.  
  60. case $PKGVERSION in
  61.     2)    PKGINSTALL_TYPE=OVERLAY    ;;
  62.     4)    PKGINSTALL_TYPE=UPGRADE    ;;
  63.     6)    PKGINSTALL_TYPE=UPGRADE2    ;;
  64.     *)    ;;
  65. esac
  66.  
  67. # Determine the number of SCO pseudo-ttys to configure for an OVERLAY
  68. # or UPGRADE. 
  69.  
  70. [ "$PKGINSTALL_TYPE" = NEWINSTALL ] || {
  71.  
  72.     AUTOMERGE=Yes
  73.  
  74.     [ "$PKGINSTALL_TYPE" = OVERLAY -o "$PKGINSTALL_TYPE" = UPGRADE2 ] && {
  75.         if [ -f /etc/inst/scripts/postreboot.sh ]
  76.         then
  77.         # We are installing from the boot floppy.
  78.         # (We checked for boot-floppy installation just in case
  79.         # at some future time the request script is called from
  80.         # the boot-floppy. The extra cost is small.)
  81.             PTM=$UPINSTALL
  82.             NSCO=`cut -f2 $PTM/node.d/pts|grep ttyp|wc -l`
  83.             [ "$NSCO" -gt "$MAX_SCO_PTS" ] && NSCO=$MAX_SCO_PTS
  84.         else
  85.         # We are installing using pkgadd on a running system.
  86.         # NOTE: If nsu is overlayed first, then there is no way to
  87.         # determine the number of SCO pty's previously setup. This
  88.         # is because nsu will install a new mtune and reinitialize
  89.         # the number of SCO pty's to the default in mtune. The fix
  90.         # for this has to be in nsu. It must determine both the 
  91.         # number of regular and SCO ptys previously setup. 
  92.             PTM=/etc/conf
  93.             if [ -f $PTM/mtune.d/ptm ]
  94.             then
  95.                                 line=`/etc/conf/bin/idtune -g NUMSCOPT`
  96.                                 set - $line
  97.                                 NSCO=$1
  98.                                 [ "$NSCO" -gt "$MAX_SCO_PTS" ] && NSCO=$MAX_SCO_PTS
  99.             else
  100.             # This is the odd case when we cannot find the old values.
  101.             # Use the defaults.
  102.                                 continue
  103.             fi
  104.         fi
  105.     }
  106.     [ "$PKGINSTALL_TYPE" = UPGRADE ] && {
  107.         if [ -f /etc/inst/scripts/postreboot.sh ]
  108.         then
  109.         # We are installing from the boot floppy.
  110.         # (We checked for boot-floppy installation just in case
  111.         # at some future time the request script is called from
  112.         # the boot-floppy. The extra cost is small.)
  113.                         PTM=$UPINSTALL
  114.         else
  115.                         PTM=/etc/conf
  116.         fi
  117.  
  118.         # We are upgrading from a pre-UnixWare 2.0 release that used
  119.         # different drivers for SCO and regular ptys. The sdevice.d/mpt
  120.         # file will have only the number of SCO ptys.
  121.                 if [ -f $PTM/sdevice.d/mpt ]
  122.         then
  123.                         grep "^mpt    " $PTM/sdevice.d/mpt >/tmp/mpt.$$ 2>/dev/null
  124.                OFS=$IFS
  125.                         IFS="    "    #tab
  126.             read Dev Conf LAST_SCO x4 </tmp/mpt.$$
  127.             [ "$Conf" = N ] && LAST_SCO=$DFLT_SCO
  128.             IFS=$OFS
  129.             rm -f /tmp/mpt.$$
  130.  
  131.             [ "$LAST_SCO" -gt "$DFLT_SCO" ] && NSCO=$LAST_SCO
  132.             [ "$NSCO" -gt "$MAX_SCO_PTS" ] && NSCO=$MAX_SCO_PTS
  133.         else
  134.         # This is the odd case when we cannot find the old values.
  135.         # Use the defaults.
  136.                                 continue
  137.         fi
  138.     }
  139. }
  140.  
  141. echo "AUTOMERGE=$AUTOMERGE" >>$OUTPUT || exit 1
  142. echo "PKGINSTALL_TYPE=$PKGINSTALL_TYPE" >>$OUTPUT || exit 1
  143. echo "INSTALL_MODE=$INSTALL_MODE" >>$OUTPUT || exit 1
  144.  
  145. ############# End  UPGRADE AND OVERLAY #######################
  146.  
  147.  
  148. #
  149. #  Put menu files in correct location
  150. #
  151. DIR=/etc/inst/locale/${LOCALE}/menus/acp
  152.  
  153. [ -d ${DIR} ] || mkdir -p ${DIR}
  154. if [ ! -f ${DIR}/menu.acp ]
  155. then
  156.     if [ -f "${REQDIR}/inst/locale/${LOCALE}/acp/menu.acp" ]
  157.     then
  158.         cp ${REQDIR}/inst/locale/${LOCALE}/acp/menu.acp ${DIR}
  159.     else
  160.         cp ${REQDIR}/acp/menu* ${DIR}
  161.     fi
  162. fi
  163.  
  164. #
  165. #  Set up to use menu_colors; default to C-locale if ${LOCALE}'s dir has
  166. #  no menu_colors.sh
  167. #
  168. if [ -f /etc/inst/locale/${LOCALE}/menus/menu_colors.sh ]
  169. then
  170.     . /etc/inst/locale/${LOCALE}/menus/menu_colors.sh
  171. else
  172.     . /etc/inst/locale/C/menus/menu_colors.sh
  173. fi
  174.  
  175. # If this is a boot-floppy installation, do not show menu.
  176. if [ ! -f /etc/inst/scripts/postreboot.sh ]
  177. then
  178.     # Make NSCO available to menu command.
  179.     export NSCO
  180.     menu_colors regular
  181.     > /tmp/out
  182.     menu -f ${DIR}/menu.acp -o /tmp/out 2> /dev/null
  183.     . /tmp/out
  184. fi
  185.  
  186. # Now a kludge. Since the boot-floppy does not run the request
  187. # script but does make an $UPGFILE, we need another flag to tell
  188. # preinstall that this request script was run. This flag is 
  189. # $NSCO in $UPGFILE. We have to empty $UPGFILE first since 
  190. # chkpkgrel puts in $PKGVERSION which gives an error when file
  191. # is dotted in by preinstall.
  192. echo "NSCO=$NSCO" >$UPGFILE
  193.  
  194. exit 0
  195.  
  196.