source: bootscripts/lfs/init.d/checkfs@ 620c6d0

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 620c6d0 was f874424, checked in by Bruce Dubbs <bdubbs@…>, 13 years ago

Rename /etc/sysconfig/init_params to /etc/sysconfig/rc.site.
Move network services to /lib/services.
Move init-functions to /lib/lsb.
Make /lib/lsb a symlink to /lib/services.
Create convenience symlink /etc/init.d->/etc/rc.d/init.d
Add help and man pages to ifup/ifdown.

Append /run/var/bootlog to /var/log/boot.log at the end of
the boot sequence.

Add capability to step through the boot scripts at boot time.

Optionally allow environment variables in sysconfig directory's
console, network, and clock files to be placed in rc.site.

Add an optional FASTBOOT parameter to set /fastboot when rebooting.

Remove a minor warning message from udev that is triggered
by the udev_retry boot script.

Add SKIPTMPCLEAN as an optional parameter to skip cleaning /tmp at boot time.

Add a page to Chapter 7 documenting rc.site.

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

  • Property mode set to 100644
File size: 4.3 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin checkfs
4#
5# Description : File System Check
6#
7# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8# A. Luebke - luebke@users.sourceforge.net
9# DJ Lucas - dj@linuxfromscratch.org
10# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
11#
12# Version : LFS 7.0
13#
14# Based on checkfs script from LFS-3.1 and earlier.
15#
16# From man fsck
17# 0 - No errors
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
25#
26#########################################################################
27
28### BEGIN INIT INFO
29# Provides: checkfs
30# Required-Start: udev swap $time
31# Should-Start:
32# Required-Stop:
33# Should-Stop:
34# Default-Start: S
35# Default-Stop:
36# Short-Description: Checks local filesystems before mounting.
37# Description: Checks local filesystmes before mounting.
38# X-LFS-Provided-By: LFS
39### END INIT INFO
40
41. /lib/lsb/init-functions
42
43case "${1}" in
44 start)
45 if [ -f /fastboot ]; then
46 msg="/fastboot found, will omit "
47 msg="${msg} file system checks as requested.\n"
48 log_info_msg "${msg}"
49 exit 0
50 fi
51
52 log_info_msg "Mounting root file system in read-only mode... "
53 mount -n -o remount,ro / >/dev/null
54
55 if [ ${?} != 0 ]; then
56 log_failure_msg2
57 msg="\n\nCannot check root "
58 msg="${msg}filesystem because it could not be mounted "
59 msg="${msg}in read-only mode.\n\n"
60 msg="${msg}After you press Enter, this system will be "
61 msg="${msg}halted and powered off.\n\n"
62 log_failure_msg "${msg}"
63
64 log_info_msg "Press Enter to continue..."
65 wait_for_user
66 /etc/rc.d/init.d/halt stop
67 else
68 log_success_msg2
69 fi
70
71 if [ -f /forcefsck ]; then
72 msg="\n/forcefsck found, forcing file"
73 msg="${msg} system checks as requested."
74 log_success_msg "$msg"
75 options="-f"
76 else
77 options=""
78 fi
79
80 log_info_msg "Checking file systems..."
81 # Note: -a option used to be -p; but this fails e.g. on fsck.minix
82 fsck ${options} -a -A -C -T
83 error_value=${?}
84
85 if [ "${error_value}" = 0 ]; then
86 log_success_msg2
87 fi
88
89 if [ "${error_value}" = 1 ]; then
90 msg="\nWARNING:\n\nFile system errors "
91 msg="${msg}were found and have been corrected.\n"
92 msg="${msg}You may want to double-check that "
93 msg="${msg}everything was fixed properly."
94 log_warning_msg "$msg"
95 fi
96
97 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
98 msg="\nWARNING:\n\nFile system errors "
99 msg="${msg}were found and have been been "
100 msg="${msg}corrected, but the nature of the "
101 msg="${msg}errors require this system to be rebooted.\n\n"
102 msg="${msg}After you press enter, "
103 msg="${msg}this system will be rebooted\n\n"
104 log_failure_msg "$msg"
105
106 log_info_msg "Press Enter to continue..."
107 wait_for_user
108 reboot -f
109 fi
110
111 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
112 msg="\nFAILURE:\n\nFile system errors "
113 msg="${msg}were encountered that could not be "
114 msg="${msg}fixed automatically. This system "
115 msg="${msg}cannot continue to boot and will "
116 msg="${msg}therefore be halted until those "
117 msg="${msg}errors are fixed manually by a "
118 msg="${msg}System Administrator.\n\n"
119 msg="${msg}After you press Enter, this system will be "
120 msg="${msg}halted and powered off.\n\n"
121 log_failure_msg "$msg"
122
123 log_info_msg "Press Enter to continue..."
124 wait_for_user
125 /etc/rc.d/init.d/halt stop
126 fi
127
128 if [ "${error_value}" -ge 16 ]; then
129 msg="\nFAILURE:\n\nUnexpected Failure "
130 msg="${msg}running fsck. Exited with error "
131 msg="${msg} code: ${error_value}."
132 log_failure_msg $msg
133 exit ${error_value}
134 fi
135
136 exit 0
137 ;;
138 *)
139 echo "Usage: ${0} {start}"
140 exit 1
141 ;;
142esac
143
144# End checkfs
Note: See TracBrowser for help on using the repository browser.