Changeset f874424 for bootscripts/lfs/init.d/checkfs
- Timestamp:
- 09/19/2011 03:31:46 AM (13 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 12.2, 12.2-rc1, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/loongarch-12.2, xry111/mips64el, xry111/multilib, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- 5a58876
- Parents:
- 103bbd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bootscripts/lfs/init.d/checkfs
r103bbd6 rf874424 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 8 # A. Luebke - luebke@users.sourceforge.net 9 # DJ Lucas - dj@linuxfromscratch.org 9 10 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 10 11 # … … 38 39 ### END INIT INFO 39 40 40 . /lib/ boot/functions41 . /lib/lsb/init-functions 41 42 42 43 case "${1}" in 43 44 start) 44 45 if [ -f /fastboot ]; then 45 boot_mesg -n "/fastboot found, will not perform" ${INFO}46 boot_mesg " file system checks as requested."47 echo_ok46 msg="/fastboot found, will omit " 47 msg="${msg} file system checks as requested.\n" 48 log_info_msg "${msg}" 48 49 exit 0 49 50 fi 50 51 51 boot_mesg "Mounting root file system in read-only mode..."52 log_info_msg "Mounting root file system in read-only mode... " 52 53 mount -n -o remount,ro / >/dev/null 53 evaluate_retval54 54 55 55 if [ ${?} != 0 ]; then 56 echo_failure 57 boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE} 58 boot_mesg -n " filesystem because it could not be mounted" 59 boot_mesg -n " in read-only mode.\n\nAfter you" 60 boot_mesg -n " press Enter, this system will be" 61 boot_mesg -n " halted and powered off." 62 boot_mesg -n "\n\nPress enter to continue..." ${INFO} 63 boot_mesg "" ${NORMAL} 56 log_failure_msg2 57 msg="\n\nCannot check root " 58 msg="${msg}filesystem because it could not be mounted " 59 msg="${msg}in read-only mode.\n\n" 60 msg="${msg}After you press Enter, this system will be " 61 msg="${msg}halted and powered off.\n\n" 62 log_failure_msg "${msg}" 63 64 log_info_msg "Press Enter to continue..." 64 65 wait_for_user 65 66 /etc/rc.d/init.d/halt stop 67 else 68 log_success_msg2 66 69 fi 67 70 68 71 if [ -f /forcefsck ]; then 69 boot_mesg -n "/forcefsck found, forcing file" ${INFO}70 boot_mesg "system checks as requested."71 echo_ok72 msg="\n/forcefsck found, forcing file" 73 msg="${msg} system checks as requested." 74 log_success_msg "$msg" 72 75 options="-f" 73 76 else … … 75 78 fi 76 79 77 boot_mesg "Checking file systems..." 78 # Note: -a option used to be -p; but this fails e.g. 79 # on fsck.minix 80 log_info_msg "Checking file systems..." 81 # Note: -a option used to be -p; but this fails e.g. on fsck.minix 80 82 fsck ${options} -a -A -C -T 81 83 error_value=${?} 82 84 83 85 if [ "${error_value}" = 0 ]; then 84 echo_ok86 log_success_msg2 85 87 fi 86 88 87 89 if [ "${error_value}" = 1 ]; then 88 echo_warning 89 boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} 90 boot_mesg -n " were found and have been corrected. " 91 boot_mesg -n " You may want to double-check that" 92 boot_mesg -n " everything was fixed properly." 93 boot_mesg "" ${NORMAL} 90 msg="\nWARNING:\n\nFile system errors " 91 msg="${msg}were found and have been corrected.\n" 92 msg="${msg}You may want to double-check that " 93 msg="${msg}everything was fixed properly." 94 log_warning_msg "$msg" 94 95 fi 95 96 96 97 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then 97 echo_warning98 boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}99 boot_mesg -n " were found and have been been"100 boot_mesg -n " corrected, but the nature of the"101 boot_mesg -n " errors require this system to be"102 boot_mesg -n " rebooted.\n\nAfter you press enter,"103 boot_mesg -n " this system will be rebooted"104 boot_mesg -n "\n\nPress Enter to continue..." ${INFO} 105 boot_mesg "" ${NORMAL}98 msg="\nWARNING:\n\nFile system errors " 99 msg="${msg}were found and have been been " 100 msg="${msg}corrected, but the nature of the " 101 msg="${msg}errors require this system to be rebooted.\n\n" 102 msg="${msg}After you press enter, " 103 msg="${msg}this system will be rebooted\n\n" 104 log_failure_msg "$msg" 105 106 log_info_msg "Press Enter to continue..." 106 107 wait_for_user 107 108 reboot -f … … 109 110 110 111 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then 111 echo_failure112 boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}113 boot_mesg -n " were encountered that could not be"114 boot_mesg -n " fixed automatically. This system"115 boot_mesg -n " cannot continue to boot and will"116 boot_mesg -n " therefore be halted until those"117 boot_mesg -n " errors are fixed manually by a"118 boot_mesg -n " System Administrator.\n\nAfter you"119 boot_mesg -n " press Enter, this system will be"120 boot_mesg -n " halted and powered off."121 boot_mesg -n "\n\nPress Enter to continue..." ${INFO} 122 boot_mesg "" ${NORMAL}112 msg="\nFAILURE:\n\nFile system errors " 113 msg="${msg}were encountered that could not be " 114 msg="${msg}fixed automatically. This system " 115 msg="${msg}cannot continue to boot and will " 116 msg="${msg}therefore be halted until those " 117 msg="${msg}errors are fixed manually by a " 118 msg="${msg}System Administrator.\n\n" 119 msg="${msg}After you press Enter, this system will be " 120 msg="${msg}halted and powered off.\n\n" 121 log_failure_msg "$msg" 122 123 log_info_msg "Press Enter to continue..." 123 124 wait_for_user 124 /etc/rc.d/init.d/halt stop125 /etc/rc.d/init.d/halt stop 125 126 fi 126 127 127 128 if [ "${error_value}" -ge 16 ]; then 128 echo_failure 129 boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE} 130 boot_mesg -n " running fsck. Exited with error" 131 boot_mesg -n " code: ${error_value}." 132 boot_mesg "" ${NORMAL} 129 msg="\nFAILURE:\n\nUnexpected Failure " 130 msg="${msg}running fsck. Exited with error " 131 msg="${msg} code: ${error_value}." 132 log_failure_msg $msg 133 133 exit ${error_value} 134 134 fi 135 136 exit 0 135 137 ;; 136 138 *)
Note:
See TracChangeset
for help on using the changeset viewer.