source: bootscripts/contrib/lsb-v3/init.d/checkfs@ 279eb4f

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 6.6 6.7 6.8 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/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 279eb4f was c990c5c, checked in by DJ Lucas <dj@…>, 15 years ago

Fix another typo. Thanks Bruce.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8850 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 3.9 KB
Line 
1#!/bin/sh
2# Begin /etc/init.d/checkfs
3
4### BEGIN INIT INFO
5# Provides: checkfs
6# Required-Start: udev swap $time
7# Should-Start:
8# Required-Stop:
9# Should-Stop:
10# Default-Start: S
11# Default-Stop:
12# Short-Description: Checks local filesystems before mounting.
13# Description: Checks local filesystmes before mounting.
14# X-LFS-Default-Start: S30
15# X-LFS-Default-Stop:
16# X-LFS-Provided-By: LFS
17### END INIT INFO
18
19. /lib/lsb/init-functions
20
21case "${1}" in
22 start)
23 if [ -f /fastboot ]; then
24 echo "${INFO}/fastboot found!"
25 log_success_msg "Will not perform file system checks as requested."
26 exit 0
27 fi
28
29 mount -n -o remount,ro / >/dev/null
30 if [ ${?} != 0 ]
31 then
32 log_failure_msg "Mounting root file system in read-only mode"
33 echo -e "${FAILURE}FAILURE:\n"
34 echo -e -n "${FAILURE}Cannot check root filesystem because it "
35 echo -e "${FAILURE}could not be mounted"
36 echo -e "${FAILURE}in read-only mode.\n\n"
37 echo -e -n "${FAILURE}After you press Enter, this system will be "
38 echo -e "${FAILURE}halted and powered off.\n"
39 echo -e "${INFO}Press enter to continue...${NORMAL}"
40 read ENTER
41 /etc/rc.d/init.d/halt stop
42 fi
43
44 if [ -f /forcefsck ]
45 then
46 echo "${INFO}/forcefsck found!"
47 log_success_msg "${INFO}Forcing file system checks as requested."
48 options="-f"
49 else
50 options=""
51 fi
52
53 # Note: -a option used to be -p; but this fails e.g.
54 # on fsck.minix
55 fsck ${options} -a -A -C -T
56 error_value=${?}
57
58 if [ "${error_value}" = 0 ]
59 then
60 log_success_msg "Checking file systems..."
61 elif [ "${error_value}" = 1 ]
62 then
63 log_warning_msg "Checking file systems..."
64 echo -e "${WARNING}WARNING:\n"
65 echo -e "${WARNING}File system errors were found and have been"
66 echo -e "${WARNING}corrected. You may want to double-check that"
67 echo -e "${WARNING}everything was fixed properly.${NORMAL}"
68 elif [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
69 log_warning_msg "Checking file systems..."
70 echo -e "${WARNING}WARNING:\n"
71 echo -e "${WARNING}File system errors were found and have been been"
72 echo -e "${WARNING}corrected, but the nature of the errors require"
73 echo -e "${WARNING}this system to be rebooted.\n"
74 echo -e "After you press enter, this system will be rebooted.\n"
75 echo -e "${INFO}Press Enter to continue...${NORMAL}"
76 read ENTER
77 reboot -f
78 elif [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
79 log_failure_msg "Checking file systems..."
80 echo -e "${FAILURE}FAILURE:\n"
81 echo -e "${FAILURE}File system errors were encountered that could"
82 echo -e "${FAILURE}not be fixed automatically. This system cannot"
83 echo -e "${FAILURE}continue to boot and will therefore be halted"
84 echo -e "${FAILURE}until those errors are fixed manually by a"
85 echo -e "${FAILURE}System Administrator.\n"
86 echo -e "${FAILURE}After you press Enter, this system will be"
87 echo -e "${FAILURE}halted and powered off.\n"
88 echo -e "${INFO}Press Enter to continue...${NORMAL}"
89 read ENTER
90 /etc/rc.d/init.d/halt stop
91 elif [ "${error_value}" -ge 16 ]; then
92 log_failure_msg "Checking file systems..."
93 echo -e "${FAILURE}FAILURE:\n"
94 echo -e "${FAILURE}Unexpected Failure running fsck. Exited with error"
95 echo -e "${FAILURE}code: ${error_value}.${NORMAL}"
96 exit ${error_value}
97 fi
98 ;;
99 *)
100 echo "Usage: ${0} {start}"
101 exit 1
102 ;;
103esac
104
105# End /etc/init.d/checkfs
Note: See TracBrowser for help on using the repository browser.