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

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 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/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since dad97de was dad97de, checked in by DJ Lucas <dj@…>, 13 years ago

Moved configuration of clock and hostname to rc.site

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