Allow fsck to be multiplexed.
This commit is contained in:
parent
7dec6f4025
commit
5ddd32c06c
13
conf.d/fsck
13
conf.d/fsck
@ -1,6 +1,17 @@
|
|||||||
# Pass any arguments to fsck.
|
# Pass any arguments to fsck.
|
||||||
# By default we preen.
|
# By default we preen.
|
||||||
fsck="-p"
|
# Linux systems also force -C0 and -T.
|
||||||
|
# If fsck_args is not specified then Linux systems also use -A
|
||||||
|
# (and -R if / is rw)
|
||||||
|
#fsck_args="-p"
|
||||||
|
|
||||||
|
# We can also specify the passno in /etc/fstab to check
|
||||||
|
# If you multiplex fsck (ie ln -s fsck /etc/init.d/fsck.late) then you can
|
||||||
|
# do an fsck outside of the normal scope, say for /home.
|
||||||
|
# Here are some exampes:-
|
||||||
|
#fsck_passno="=1 =2"
|
||||||
|
#fsck_passno=">1"
|
||||||
|
#fsck_passno="<2"
|
||||||
|
|
||||||
# fsck_shutdown causes fsck to trigger during shutdown as well as startup.
|
# fsck_shutdown causes fsck to trigger during shutdown as well as startup.
|
||||||
# The end result of this is that if any periodic non-root filesystem checks are
|
# The end result of this is that if any periodic non-root filesystem checks are
|
||||||
|
24
init.d/fsck
24
init.d/fsck
@ -3,6 +3,8 @@
|
|||||||
# All rights reserved. Released under the 2-clause BSD license.
|
# All rights reserved. Released under the 2-clause BSD license.
|
||||||
|
|
||||||
description="Check and repair filesystems according to /etc/fstab"
|
description="Check and repair filesystems according to /etc/fstab"
|
||||||
|
_ISF="
|
||||||
|
"
|
||||||
|
|
||||||
depend()
|
depend()
|
||||||
{
|
{
|
||||||
@ -12,20 +14,32 @@ depend()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local reboot_opts= fsck_opts=
|
local reboot_opts= fsck_opts= p=
|
||||||
|
|
||||||
|
ebegin "Checking local filesystems"
|
||||||
|
for p in ${fsck_passno}; do
|
||||||
|
local IFS="${_IFS}"
|
||||||
|
case "${p}" in
|
||||||
|
[0-9]*) p="=${p}";;
|
||||||
|
esac
|
||||||
|
set -- "$@" "$(fstabinfo --passno "${p}")"
|
||||||
|
unset IFS
|
||||||
|
done
|
||||||
|
|
||||||
if [ "${RC_UNAME}" = "Linux" ]; then
|
if [ "${RC_UNAME}" = "Linux" ]; then
|
||||||
fsck_opts="-A -C0 -T"
|
fsck_opts="-C0 -T"
|
||||||
|
if [ -z "${fsck_passno}" ]; then
|
||||||
|
fsck_args=${fsck_args--A -p}
|
||||||
if echo 2>/dev/null >/.test.$$; then
|
if echo 2>/dev/null >/.test.$$; then
|
||||||
rm -f /.test.$$
|
rm -f /.test.$$
|
||||||
fsck_opts="${fsck_opts} -R"
|
fsck_opts="-R"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
reboot_opts="-f"
|
reboot_opts="-f"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ebegin "Checking local filesystems"
|
|
||||||
trap : QUIT
|
trap : QUIT
|
||||||
fsck ${fsck_args--p} ${fsck_opts}
|
fsck ${fsck_args--p} ${fsck_opts} "$@"
|
||||||
case $? in
|
case $? in
|
||||||
0) eend 0; return 0;;
|
0) eend 0; return 0;;
|
||||||
1) ewend 1 "Filesystems repaired"; return 0;;
|
1) ewend 1 "Filesystems repaired"; return 0;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user