source: bootscripts/lfs/init.d/checkfs@ b9560f3

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 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 b9560f3 was b9560f3, checked in by DJ Lucas <dj@…>, 4 years ago

Remove errant swap dependency for checkfs

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

  • Property mode set to 100644
File size: 4.4 KB
RevLine 
[1c48007]1#!/bin/sh
2########################################################################
[0cda898]3# Begin checkfs
[1c48007]4#
5# Description : File System Check
6#
7# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
[77e2988]8# A. Luebke - luebke@users.sourceforge.net
[f874424]9# DJ Lucas - dj@linuxfromscratch.org
[0cda898]10# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
[1c48007]11#
[0cda898]12# Version : LFS 7.0
[1c48007]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
[0cda898]28### BEGIN INIT INFO
29# Provides: checkfs
[b9560f3]30# Required-Start: udev
[0cda898]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
[f874424]41. /lib/lsb/init-functions
[1c48007]42
43case "${1}" in
[0cda898]44 start)
45 if [ -f /fastboot ]; then
[f874424]46 msg="/fastboot found, will omit "
47 msg="${msg} file system checks as requested.\n"
48 log_info_msg "${msg}"
[0cda898]49 exit 0
50 fi
[1c48007]51
[f874424]52 log_info_msg "Mounting root file system in read-only mode... "
[0cda898]53 mount -n -o remount,ro / >/dev/null
[1c48007]54
[0cda898]55 if [ ${?} != 0 ]; then
[f874424]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..."
[0cda898]65 wait_for_user
66 /etc/rc.d/init.d/halt stop
[f874424]67 else
68 log_success_msg2
[0cda898]69 fi
[1c48007]70
[0cda898]71 if [ -f /forcefsck ]; then
[d83fd51]72 msg="/forcefsck found, forcing file"
[f874424]73 msg="${msg} system checks as requested."
74 log_success_msg "$msg"
[0cda898]75 options="-f"
76 else
77 options=""
78 fi
[1c48007]79
[f874424]80 log_info_msg "Checking file systems..."
81 # Note: -a option used to be -p; but this fails e.g. on fsck.minix
[12574f2]82 if is_true "$VERBOSE_FSCK"; then
[85ce884e]83 fsck ${options} -a -A -C -T
[12574f2]84 else
[85ce884e]85 fsck ${options} -a -A -C -T >/dev/null
[12574f2]86 fi
87
[0cda898]88 error_value=${?}
[1c48007]89
[0cda898]90 if [ "${error_value}" = 0 ]; then
[f874424]91 log_success_msg2
[0cda898]92 fi
[1c48007]93
[0cda898]94 if [ "${error_value}" = 1 ]; then
[f874424]95 msg="\nWARNING:\n\nFile system errors "
96 msg="${msg}were found and have been corrected.\n"
[d83fd51]97 msg="${msg} You may want to double-check that "
[f874424]98 msg="${msg}everything was fixed properly."
99 log_warning_msg "$msg"
[0cda898]100 fi
[1c48007]101
[0cda898]102 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
[f874424]103 msg="\nWARNING:\n\nFile system errors "
104 msg="${msg}were found and have been been "
105 msg="${msg}corrected, but the nature of the "
106 msg="${msg}errors require this system to be rebooted.\n\n"
107 msg="${msg}After you press enter, "
108 msg="${msg}this system will be rebooted\n\n"
109 log_failure_msg "$msg"
110
111 log_info_msg "Press Enter to continue..."
[0cda898]112 wait_for_user
113 reboot -f
114 fi
[1c48007]115
[0cda898]116 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
[f874424]117 msg="\nFAILURE:\n\nFile system errors "
118 msg="${msg}were encountered that could not be "
[d83fd51]119 msg="${msg}fixed automatically.\nThis system "
[f874424]120 msg="${msg}cannot continue to boot and will "
121 msg="${msg}therefore be halted until those "
122 msg="${msg}errors are fixed manually by a "
123 msg="${msg}System Administrator.\n\n"
124 msg="${msg}After you press Enter, this system will be "
125 msg="${msg}halted and powered off.\n\n"
126 log_failure_msg "$msg"
127
128 log_info_msg "Press Enter to continue..."
[0cda898]129 wait_for_user
[f874424]130 /etc/rc.d/init.d/halt stop
[0cda898]131 fi
[1c48007]132
[0cda898]133 if [ "${error_value}" -ge 16 ]; then
[d83fd51]134 msg="FAILURE:\n\nUnexpected failure "
[f874424]135 msg="${msg}running fsck. Exited with error "
[d83fd51]136 msg="${msg} code: ${error_value}.\n"
137 log_info_msg $msg
[0cda898]138 exit ${error_value}
139 fi
[f874424]140
141 exit 0
[0cda898]142 ;;
143 *)
144 echo "Usage: ${0} {start}"
145 exit 1
146 ;;
[1c48007]147esac
148
[0cda898]149# End checkfs
Note: See TracBrowser for help on using the repository browser.