| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 | 
							- #!/bin/sh
 
- # Begin $RC_BASE/init.d/checkfs
 
- ### BEGIN INIT INFO
 
- # Provides:            checkfs
 
- # Required-Start:      udev swap
 
- # Should-Start:
 
- # Required-Stop:
 
- # Should-Stop:
 
- # Default-Start:       S
 
- # Default-Stop:
 
- # Short-Description:   Checks local filesystems before mounting.
 
- # Description:         Checks local filesystmes before mounting.
 
- # X-LFS-Provided-By:   LFS
 
- ### END INIT INFO
 
- . /lib/lsb/init-functions
 
- case "${1}" in
 
-     start)
 
-         if [ -f /fastboot ]; then
 
-             echo "${INFO}/fastboot found!"
 
-             log_success_msg "Will not perform file system checks as requested."
 
-             exit 0
 
-         fi
 
-         mount -n -o remount,ro / >/dev/null
 
-         if [ ${?} -ne 0 ]
 
-         then
 
-             log_failure_msg "Mounting root file system in read-only mode"
 
-             echo -e "${FAILURE}FAILURE:\n"
 
-             echo -e -n "${FAILURE}Cannot check root filesystem because it "
 
-             echo -e "${FAILURE}could not be mounted"
 
-             echo -e "${FAILURE}in read-only mode.\n\n"
 
-             echo -e -n "${FAILURE}After you press Enter, this system will be "
 
-             echo -e "${FAILURE}halted and powered off.\n"
 
-             echo -e "${INFO}Press enter to continue...${NORMAL}"
 
-             $FAILURE_ACTION
 
-             /etc/rc.d/init.d/halt stop
 
-         fi
 
-         if [ -f /forcefsck ]
 
-         then
 
-             echo "${INFO}/forcefsck found!"
 
-             log_success_msg "${INFO}Forcing file system checks as requested."
 
-             options="-f"
 
-         else
 
-             options=""
 
-         fi
 
-         # Note: -a option used to be -p; but this fails e.g.
 
-         # on fsck.minix
 
-         fsck ${options} -a -A -C -T
 
-         error_value=${?}
 
-         if [ "${error_value}" -eq 0 ]
 
-         then
 
-             log_success_msg "Checking file systems..."
 
-         elif [ "${error_value}" -eq 1 ]
 
-         then
 
-             log_warning_msg "Checking file systems..."
 
-             echo -e "${WARNING}WARNING:\n"
 
-             echo -e "${WARNING}File system errors were found and have been"
 
-             echo -e "${WARNING}corrected.  You may want to double-check that"
 
-             echo -e "${WARNING}everything was fixed properly.${NORMAL}"
 
-         elif [ "${error_value}" -eq 2 -o "${error_value}" -eq 3 ]; then
 
-             log_warning_msg "Checking file systems..."
 
-             echo -e "${WARNING}WARNING:\n"
 
-             echo -e "${WARNING}File system errors were found and have been been"
 
-             echo -e "${WARNING}corrected, but the nature of the errors require"
 
-             echo -e "${WARNING}this system to be rebooted.\n"
 
-             echo -e "After you press enter, this system will be rebooted.\n"
 
-             echo -e "${INFO}Press Enter to continue...${NORMAL}"
 
-             $FAILURE_ACTION
 
-             reboot -f
 
-         elif [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
 
-             log_failure_msg "Checking file systems..."
 
-             echo -e "${FAILURE}FAILURE:\n"
 
-             echo -e "${FAILURE}File system errors were encountered that could"
 
-             echo -e "${FAILURE}not be fixed automatically.  This system cannot"
 
-             echo -e "${FAILURE}continue to boot and will therefore be halted"
 
-             echo -e "${FAILURE}until those errors are fixed manually by a"
 
-             echo -e "${FAILURE}System Administrator.\n"
 
-             echo -e "${FAILURE}After you press Enter, this system will be"
 
-             echo -e "${FAILURE}halted and powered off.\n"
 
-             echo -e "${INFO}Press Enter to continue...${NORMAL}"
 
-             $FAILURE_ACTION
 
-             /etc/rc.d/init.d/halt stop
 
-         elif [ "${error_value}" -ge 16 ]; then
 
-             log_failure_msg "Checking file systems..."
 
-             echo -e "${FAILURE}FAILURE:\n"
 
-             echo -e "${FAILURE}Unexpected Failure running fsck.  Exited with error"
 
-             echo -e "${FAILURE}code: ${error_value}.${NORMAL}"
 
-             exit ${error_value}
 
-         fi
 
-         ;;
 
-     *)
 
-         echo "Usage: ${0} {start}"
 
-         exit 1
 
-         ;;
 
- esac
 
- # End $RC_BASE/init.d/checkfs
 
 
  |