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

  1. #ident    "@(#)pkg.acp:preinstall    1.1.3.13"
  2. #ident    "$Header: $"
  3.  
  4. CONFDIR=/etc/conf
  5. CONFBIN=${CONFDIR}/bin
  6.  
  7. #add the group dos to /etc/group for the dos commands
  8. grep "^dos:" /etc/group 2>&1 >/dev/null
  9. if [ $? -eq 0 ]
  10. then
  11.     # Stay the DOS gid as it was.
  12.     :
  13. else
  14.     _GROUP=`cat /etc/group | grep ":100:" | cut -f3`
  15.     if [ -z "${_GROUP}" ]
  16.     then
  17.         groupadd -g 100 dos 2>&1 > /dev/null
  18.     else
  19.         groupadd dos 2>&1 > /dev/null
  20.     fi
  21. fi
  22.  
  23. UPINSTALL=/etc/conf.sav
  24. UPGRADE_STORE=/etc/inst/save.user
  25. UPGFILE=${UPGRADE_STORE}/${PKGINST}.env
  26. SCRIPTS=/usr/sbin/pkginst
  27. . ${SCRIPTS}/updebug
  28.  
  29. [ "$UPDEBUG" = YES ] && {
  30.     set -x
  31.     goany
  32. }
  33.  
  34. # The boot-floppy scripts will create $UPGFILE when an upgrade or
  35. # overlay is done. $UPGFILE will contain $NSCO if the
  36. # request script was run and only if the request is run. 
  37. # If $NSCO is not present, set it in this preinstall.
  38.  
  39. [ -f "$UPGFILE" ] && . $UPGFILE
  40.  
  41. [ "$NSCO" ] || {
  42.  
  43.     # Since NSCO is not set, this is either a boot-floppy
  44.     # installation or we are pkgadding a set and installing
  45.     # acp in automatic mode. Do not determine PKGINSTALL_TYPE
  46.     # or AUTOMERGE if this is a boot-floppy install since these
  47.     # variables are in UPGFILE already.
  48.     if [ ! -f /etc/inst/scripts/postreboot.sh ]
  49.     then
  50.         #We are installing acp by pkgadding a set.
  51.         PKGINSTALL_TYPE=NEWINSTALL
  52.         
  53.         # Call chkpkgrel to determine installation type.
  54.         ${SCRIPTS}/chkpkgrel
  55.         PKGVERSION=$?
  56.         
  57.         case $PKGVERSION in
  58.             2)    PKGINSTALL_TYPE=OVERLAY    ;;
  59.             4)    PKGINSTALL_TYPE=UPGRADE    ;;
  60.             6)    PKGINSTALL_TYPE=UPGRADE2    ;;
  61.             *)    ;;
  62.         esac
  63.         rm -f $UPGFILE
  64.     fi
  65.         # Since the new mtune.d/ptm is not installed yet, we get the
  66.         # number of default SCO pseudo-ttys from the pkginfo file.
  67.         # The default we use depends on the number of licensed users.
  68.         NUM_USERS=`keyadm -g USERS|cut -f1`
  69.         if [ "$NUM_USERS" = "2" ]
  70.     then
  71.         DFLT_SCO=$DFLT_SCO_PE
  72.     else
  73.         DFLT_SCO=$DFLT_SCO_AS
  74.     fi
  75.     NSCO=$DFLT_SCO
  76.     
  77.     [ "$PKGINSTALL_TYPE" = OVERLAY -o "$PKGINSTALL_TYPE" = UPGRADE2 ] && {
  78.                 if [ -f /etc/inst/scripts/postreboot.sh ]
  79.         then
  80.         # We are installing from the boot floppy.
  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.
  86.                         PTM=/etc/conf
  87.                         if [ -f $PTM/mtune.d/ptm ]
  88.                         then
  89.                                 line=`/etc/conf/bin/idtune -g NUMSCOPT`
  90.                                 set - $line
  91.                                 NSCO=$1
  92.                                 [ "$NSCO" -gt "$MAX_SCO_PTS" ] && NSCO=$MAX_SCO_PTS
  93.              else
  94.                         # This is the odd case when we cannot find the old values.
  95.             # Use the defaults.
  96.                                 continue
  97.                         fi
  98.         fi
  99.         }
  100.  
  101.     [ "$PKGINSTALL_TYPE" = UPGRADE ] && {
  102.         if [ -f /etc/inst/scripts/postreboot.sh ]
  103.         then
  104.         # We are installing from the boot floppy.
  105.                         PTM=$UPINSTALL
  106.         else
  107.             PTM=/etc/conf
  108.         fi
  109.  
  110.         # We are upgrading from a pre-UnixWare 2.0 release that used
  111.         # different drivers for SCO and regular ptys. The sdevice.d/ptm
  112.         # file will have only the number of regular ptys.
  113.         if [ -f $PTM/sdevice.d/mpt ]
  114.         then
  115.             grep "^mpt    " $PTM/sdevice.d/mpt >/tmp/mpt.$$ 2>/dev/null
  116.             OFS=$IFS
  117.             IFS="    "    #tab
  118.             read Dev Conf LAST_SCO x4 </tmp/mpt.$$
  119.             [ "$Conf" = N ] && LAST_SCO=$DFLT_SCO
  120.             IFS=$OFS
  121.             rm -f /tmp/mpt.$$
  122.  
  123.             [ "$LAST_SCO" -gt "$DFLT_SCO" ] && NSCO=$LAST_SCO
  124.             [ "$NSCO" -gt "$MAX_SCO_PTS" ] && NSCO=$MAX_SCO_PTS
  125.         else
  126.         # This is the odd case when we cannot find the old values.
  127.         # Use the defaults.
  128.                                 continue
  129.         fi
  130.         }
  131. }
  132.  
  133. # Save volatile files
  134. ${SCRIPTS}/pkgsavfiles ${PKGINST}
  135.  
  136. # pkgsavfiles may change AUTOMERGE to NULL if there are not
  137. # files to merge or if it is a new installation.  Therefore,
  138. # find out what value it set.  Don't just overwrite it.
  139. . $UPGFILE
  140.  
  141. echo "PKGINSTALL_TYPE=${PKGINSTALL_TYPE}" >$UPGFILE || exit 1
  142. echo "AUTOMERGE=${AUTOMERGE}" >>$UPGFILE || exit 1
  143. echo "NSCO=$NSCO" >>$UPGFILE || exit 1
  144.  
  145. exit 0
  146.  
  147.