]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/initscripts/system/checkfs
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
27 if [ -f /fastboot
]; then
28 boot_mesg
-n "/fastboot found, will not perform" ${INFO}
29 boot_mesg
" file system checks as requested."
34 boot_mesg
"Mounting root file system in read-only mode..."
35 mount
-n -o remount
,ro
/ >/dev
/null
38 if [ ${?} != 0 ]; then
40 boot_mesg
-n "FAILURE:\n\nCannot check root" ${FAILURE}
41 boot_mesg
-n " filesystem because it could not be mounted"
42 boot_mesg
-n " in read-only mode.\n\nAfter you"
43 boot_mesg
-n " press Enter, this system will be"
44 boot_mesg
-n " halted and powered off."
45 boot_mesg
-n "\n\nPress enter to continue or wait a minute..." ${INFO}
46 boot_mesg
"" ${NORMAL}
48 ${rc_base}/init.d
/halt stop
51 if [ -f /forcefsck
]; then
52 boot_mesg
-n "/forcefsck found, forcing file" ${INFO}
53 boot_mesg
" system checks as requested."
60 boot_mesg
"Checking file systems..."
61 # Note: -a option used to be -p; but this fails e.g.
63 fsck
${options} -a -A -C -T 2>/dev
/null
66 if [ "${error_value}" = 0 ]; then
70 if [ "${error_value}" = 1 ]; then
72 boot_mesg
-n "WARNING:\n\nFile system errors" ${WARNING}
73 boot_mesg
-n " were found and have been corrected."
74 boot_mesg
-n " You may want to double-check that"
75 boot_mesg
-n " everything was fixed properly."
76 boot_mesg
"" ${NORMAL}
79 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
81 boot_mesg
-n "WARNING:\n\nFile system errors" ${WARNING}
82 boot_mesg
-n " were found and have been been"
83 boot_mesg
-n " corrected, but the nature of the"
84 boot_mesg
-n " errors require this system to be"
85 boot_mesg
-n " rebooted.\n\nAfter you press enter,"
86 boot_mesg
-n " this system will be rebooted"
87 boot_mesg
-n "\n\nPress Enter to continue or wait a minute..." ${INFO}
88 boot_mesg
"" ${NORMAL}
93 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
96 boot_mesg
-n "FAILURE:\n\nFile system errors" ${FAILURE}
97 boot_mesg
-n " were encountered that could not be"
98 boot_mesg
-n " fixed automatically. This system"
99 boot_mesg
-n " cannot continue to boot and will"
100 boot_mesg
-n " therefore be halted until those"
101 boot_mesg
-n " errors are fixed manually by a"
102 boot_mesg
-n " System Administrator.\n\n"
103 boot_mesg
"" ${NORMAL}
108 if [ "${error_value}" -ge 16 ]; then
110 boot_mesg
-n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
111 boot_mesg
-n " running fsck. Exited with error"
112 boot_mesg
-n " code: ${error_value}."
113 boot_mesg
"" ${NORMAL}
118 echo "Usage: ${0} {start}"