]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/checkfs
2 ########################################################################
3 # Begin $rc_base/init.d/checkfs
5 # Description : File System Check
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8 # A. Luebke - luebke@users.sourceforge.net
14 # Based on checkfs script from LFS-3.1 and earlier.
18 # 1 - File system errors corrected
19 # 2 - System should be rebooted
20 # 4 - File system errors left uncorrected
21 # 8 - Operational error
22 # 16 - Usage or syntax error
23 # 32 - Fsck canceled by user request
24 # 128 - Shared library error
26 #########################################################################
33 if [ -f /fastboot
]; then
34 boot_mesg
-n "/fastboot found, will not perform" ${INFO}
35 boot_mesg
" file system checks as requested."
40 boot_mesg
"Mounting root file system in read-only mode..."
41 mount
-n -o remount
,ro
/ >/dev
/null
44 if [ ${?} != 0 ]; then
46 boot_mesg
-n "FAILURE:\n\nCannot check root" ${FAILURE}
47 boot_mesg
-n " filesystem because it could not be mounted"
48 boot_mesg
-n " in read-only mode.\n\nAfter you"
49 boot_mesg
-n " press Enter, this system will be"
50 boot_mesg
-n " halted and powered off."
51 boot_mesg
-n "\n\nPress enter to continue..." ${INFO}
52 boot_mesg
"" ${NORMAL}
54 ${rc_base}/init.d
/halt stop
57 if [ -f /forcefsck
]; then
58 boot_mesg
-n "/forcefsck found, forcing file" ${INFO}
59 boot_mesg
" system checks as requested."
66 boot_mesg
"Checking file systems..."
67 # Note: -a option used to be -p; but this fails e.g.
69 fsck
${options} -a -A -C -T 2>/dev
/null
72 if [ "${error_value}" = 0 ]; then
76 if [ "${error_value}" = 1 ]; then
78 boot_mesg
-n "WARNING:\n\nFile system errors" ${WARNING}
79 boot_mesg
-n " were found and have been corrected."
80 boot_mesg
-n " You may want to double-check that"
81 boot_mesg
-n " everything was fixed properly."
82 boot_mesg
"" ${NORMAL}
85 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
87 boot_mesg
-n "WARNING:\n\nFile system errors" ${WARNING}
88 boot_mesg
-n " were found and have been been"
89 boot_mesg
-n " corrected, but the nature of the"
90 boot_mesg
-n " errors require this system to be"
91 boot_mesg
-n " rebooted.\n\nAfter you press enter,"
92 boot_mesg
-n " this system will be rebooted"
93 boot_mesg
-n "\n\nPress Enter to continue..." ${INFO}
94 boot_mesg
"" ${NORMAL}
99 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
101 boot_mesg
-n "FAILURE:\n\nFile system errors" ${FAILURE}
102 boot_mesg
-n " were encountered that could not be"
103 boot_mesg
-n " fixed automatically. This system"
104 boot_mesg
-n " cannot continue to boot and will"
105 boot_mesg
-n " therefore be halted until those"
106 boot_mesg
-n " errors are fixed manually by a"
107 boot_mesg
-n " System Administrator.\n\nAfter you"
108 boot_mesg
-n " press Enter, this system will be"
109 boot_mesg
-n " halted and powered off."
110 boot_mesg
-n "\n\nPress Enter to continue..." ${INFO}
111 boot_mesg
"" ${NORMAL}
113 ${rc_base}/init.d
/halt stop
116 if [ "${error_value}" -ge 16 ]; then
118 boot_mesg
-n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
119 boot_mesg
-n " running fsck. Exited with error"
120 boot_mesg
-n " code: ${error_value}."
121 boot_mesg
"" ${NORMAL}
126 echo "Usage: ${0} {start}"
131 # End $rc_base/init.d/checkfs