home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 4.ddi / sbin / bcheckrc < prev    next >
Encoding:
Text File  |  1990-12-08  |  2.3 KB  |  100 lines

  1.  
  2. #!/sbin/sh
  3. #    Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
  4. #      All Rights Reserved
  5.  
  6. #    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
  7. #    The copyright notice above does not evidence any
  8. #    actual or intended publication of such source code.
  9.  
  10. #ident    "@(#)/sbin/bcheckrc.sl 1.1 4.0 12/08/90 20693 AT&T-USL"
  11.  
  12. # This file has those commands necessary to check the file
  13. # system, date, and anything else that should be done before mounting
  14. # the file systems.
  15.  
  16. /sbin/dumpcheck
  17. echo MARK > /dev/rswap
  18.  
  19. rootfs=/dev/root
  20. rrootfs=/dev/rroot
  21. vfstab=/etc/vfstab
  22.  
  23. # Try to get the file system type for root.  If this fails,
  24. # it will be set to null.  In that case, we hope that vfstab
  25. # is around so that fsck will use it for the type.
  26. set `/sbin/df -n /` > /dev/null
  27. if [ "$3" = "" ]
  28. then
  29.     fstyp=""
  30. else
  31.     fstyp="-F $3"
  32. fi
  33.  
  34. /sbin/fsck $fstyp -m  ${rrootfs}  >/dev/null 2>&1
  35.  
  36. if [ $? -ne 0 ]
  37. then
  38.     echo "The root file system (${rrootfs}) is being checked."
  39.     /sbin/fsck $fstyp -y ${rrootfs}
  40.  
  41.     case $? in
  42.       0|40)    # remount or reboot the root file system
  43.         echo "  *** ROOT REMOUNTED ***"
  44.         uadmin 4 0
  45.         ;;
  46.  
  47.       39)    # couldn't fix root - enter a shell
  48.         echo "  *** ROOT COULD NOT BE REPAIRED - Entering shell"
  49.         /sbin/sh
  50.         # repair work has hopefully completed so reboot
  51.         echo "  *** SYSTEM WILL REBOOT AUTOMATICALLY ***"
  52.         uadmin 2 2
  53.         ;;
  54.  
  55.       *)    # fsck determined reboot is necessary
  56.         echo "bcheckrc: warning, return value $? from fsck"
  57.         echo "  *** SYSTEM WILL REBOOT ***"
  58.         uadmin 2 0
  59.     esac
  60. fi
  61.  
  62. #
  63. #  Comment out for now:
  64. #
  65.  
  66. # put root into mount table
  67. echo "${rootfs} /" | /sbin/setmnt
  68.  
  69.  
  70. # Initialize name of system from name stored in /etc/nodename.
  71. [ -s /etc/nodename ] && read node </etc/nodename && [ -n node ] &&
  72.     /sbin/uname -S "$node"
  73. set `/sbin/uname -a`
  74. echo "Node: $2" >&2
  75.  
  76. /sbin/mount /proc > /dev/null 2>&1
  77.  
  78. /sbin/mount /dev/fd > /dev/null 2>&1
  79.  
  80. while read bdevice rdevice mntp fstype fsckpass automnt mntopts
  81. do
  82.     # check for comments
  83.     case ${bdevice} in
  84.     '#'*)    continue
  85.     esac
  86.  
  87.     # see if this is /var - check and mount if it is
  88.     if [ "${mntp}" = "/var" ]
  89.     then
  90.         /sbin/fsck -F ${fstype} -m  ${rdevice}  >/dev/null 2>&1
  91.         if [ $? -ne 0 ]
  92.         then
  93.             echo "The $mntp file system (${rdevice}) is being checked."
  94.             /sbin/fsck -F ${fstype} -y  ${rdevice}
  95.         fi
  96.         /sbin/mount ${mntp} > /dev/null 2>/dev/null
  97.     fi
  98. done < $vfstab
  99.  
  100.