home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / base / root.15 / sbin / rc2 / rc2~
Text File  |  1998-08-19  |  3KB  |  156 lines

  1. #!/sbin/sh
  2.  
  3. # Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  4. #                                                                         
  5. #        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  6. #                   SANTA CRUZ OPERATION INC.                             
  7. #                                                                         
  8. #   The copyright notice above does not evidence any actual or intended   
  9. #   publication of such source code.                                      
  10.  
  11.  
  12. #ident    "@(#)initpkg:i386/cmd/initpkg/rc2.sh    1.16.22.1"
  13.  
  14. #    "Run Commands" executed when the system is changing to init state 2,
  15. #    traditionally called "multi-user".
  16.  
  17. if [ -z "$LC_ALL" -a -z "$LC_MESSAGES" ]
  18. then
  19.     if [ -z "$LANG" ]
  20.     then
  21.         LNG=`defadm locale LANG 2>/dev/null`
  22.         if [ "$?" != 0 ]
  23.         then LANG=C
  24.         else eval $LNG
  25.         fi
  26.     fi
  27.     LC_MESSAGES=/etc/inst/locale/$LANG
  28.     export LANG LC_MESSAGES
  29. fi
  30. LABEL="UX:$0"
  31.  
  32. CAT=uxrc; export CAT
  33.  
  34. . /etc/TIMEZONE
  35.  
  36. #
  37. #  update the device table and the contents file for PDI devices
  38. #
  39.  
  40. if [ -s /etc/scsi/installf.input ]
  41. then
  42.     pfmt -l $LABEL -s info -g $CAT:195 "\nPlease wait while Device Database is updated.  This may take a few minutes.\n\n"
  43.     /etc/scsi/pdimkdtab -fi 2>/etc/scsi/dtab.out
  44. fi
  45.  
  46. #
  47. #  backup the device table files in case of corruption
  48. #
  49.  
  50. if [ \! -f /etc/.device.tab ]
  51. then
  52.     cp /etc/device.tab /etc/.device.tab >/dev/null 2>&1
  53. fi
  54.  
  55. if [ \! -f /etc/security/ddb/.ddb_dsfmap ]
  56. then
  57.     cp /etc/security/ddb/ddb_dsfmap /etc/security/ddb/.ddb_dsfmap >/dev/null 2>&1
  58. fi
  59.  
  60. if [ \! -f /etc/security/mac/.ltf.alias ]
  61. then
  62.     cp /etc/security/mac/ltf.alias /etc/security/mac/.ltf.alias >/dev/null 2>&1
  63. fi
  64.  
  65. #
  66. #    Pickup start-up packages for mounts, daemons, services, etc.
  67. #
  68.  
  69. set -- `LC_ALL=C /sbin/who -r`
  70. _CURR_RL=$7 _CURR_NTIMES=$8 _PREV_RL=$9 export _CURR_RL _CURR_NTIMES _PREV_RL
  71. unset _AUTOBOOT _AUTOKILL _AUTOUMOUNT
  72. case "$_PREV_RL" in
  73. s | S )
  74.     if [ \( "$_CURR_RL" -eq 2 -o "$_CURR_RL" -eq 3 \) \
  75.          -a "$_CURR_NTIMES" -eq 0 ]
  76.     then
  77.         _AUTOBOOT=true export _AUTOBOOT
  78.     fi
  79.     ;;
  80. esac
  81.  
  82. if [ x$_PREV_RL = "xS" -o x$_PREV_RL = "x1" ]
  83. then
  84.     BOOT=yes
  85.  
  86. elif [ x$_CURR_RL = "x2" ]
  87. then
  88.     pfmt -l $LABEL -s info -g $CAT:77 "Changing to state 2.\n"
  89.     cd /etc/rc2.d 2>/dev/null
  90.     if [ $? -eq 0 ]
  91.     then
  92.         for f in K*
  93.         {
  94.             case $f in
  95.             K\* ) ;;
  96.             * ) /sbin/sh ${f} stop ;;
  97.             esac
  98.         }
  99.     fi
  100. fi
  101.  
  102. cd /etc/rc2.d 2>/dev/null
  103. if [ $? -eq 0 ]
  104. then
  105.     for f in S*
  106.     {
  107.         case $f in
  108.         S\* ) ;;
  109.         S01MOUNTFSYS )    /sbin/sh ${f} start
  110.                 [ -d /usr/lib ] && LC_MESSAGES=$LANG ;;
  111.         * ) /sbin/sh ${f} start ;;
  112.         esac
  113.     }
  114. fi
  115.  
  116. # Execute rc scripts from driver packages (386)
  117. cd /etc/idrc.d 2>/dev/null
  118. if [ $? -eq 0 ]
  119. then
  120.     for f in *
  121.     {
  122.         case $f in
  123.         \* ) ;;
  124.         * ) /sbin/sh ${f} ;;
  125.         esac
  126.     }
  127. fi
  128.  
  129. if [ "${BOOT}" = "yes" ]
  130. then
  131.     cd /etc/rc.d 2>/dev/null
  132.     if [ $? -eq 0 ]
  133.     then
  134.         for f in *
  135.         {
  136.             case $f in
  137.             \* ) ;;
  138.             * ) [ ! -s /etc/init.d/${f} ] && /sbin/sh ${f} ;;
  139.             esac
  140.         }
  141.     fi
  142.     cd /
  143. fi
  144.  
  145. if [ x$_CURR_RL = "x2" ]
  146. then
  147.     if [ "${BOOT}" = "yes" ]
  148.     then
  149.         # Enhanced Application Compatibility  Support
  150.         /usr/bin/cat /etc/copyrights/*  2> /dev/null
  151.         # End Enhanced Application Compatibility Support
  152.     else
  153.         pfmt -l $LABEL -s info -g $CAT:78 "Change to state 2 has been completed.\n"
  154.     fi
  155. fi
  156.