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

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 6.4 6.5 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/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 12bc336 was 1c48007, checked in by Bruce Dubbs <bdubbs@…>, 16 years ago

Moved bootscripts and udev-config to BOOK
Updated Makefile to automatically generate bootscript and udev-config tarballs
Updated licesnse to be the same as BLFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8548 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: lvm
8# Required-Stop:
9# Should-Stop:
10# Default-Start: sysinit
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 "${FAILURE}FAILURE:\n"
34 echo -n "${FIALURE}Cannot check root filesystem because it "
35 echo "${FAILURE}could not be mounted"
36 echo "${FAILURE}in read-only mode.\n\n"
37 echo -n "${FAILURE}After you press Enter, this system will be "
38 echo "${FAILURE}halted and powered off.\n"
39 echo "${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 "${WARNING}WARNING:\n"
65 echo "${WARNING}File system errors were found and have been"
66 echo "${WARNING}corrected. You may want to double-check that"
67 echo "${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 "${WARNING}WARNING:\n"
71 echo "${WARNING}File system errors were found and have been been"
72 echo "${WARNING}corrected, but the nature of the errors require"
73 echo "${WARNING}this system to be rebooted.\n"
74 echo "After you press enter, this system will be rebooted.\n"
75 echo "${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 "${FAILURE}FAILURE:\n"
81 echo "${FAILURE}File system errors were encountered that could"
82 echo "${FAILURE}not be fixed automatically. This system cannot"
83 echo "${FAILURE}continue to boot and will therefore be halted"
84 echo "${FAILURE}until those errors are fixed manually by a"
85 echo "${FAILURE}System Administrator.\n"
86 echo "${FAILURE}After you press Enter, this system will be"
87 echo "${FAILURE}halted and powered off.\n"
88 echo "${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 "${FAILURE}FAILURE:\n"
94 echo "${FAILURE}Unexpected Failure running fsck. Exited with error"
95 echo "${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.