From 692bb1c3bb6ca4869223fbb5bbc908b8eb21fbb3 Mon Sep 17 00:00:00 2001
From: Dima Dorfman
Date: Tue, 22 May 2001 00:05:48 +0000
Subject: [PATCH] Introduce a background_fsck rc.conf option which allows the
user to enable or disable background fsck'ing all in one shot. Default is
currently 'YES'.
Reviewed by: jkh
---
etc/defaults/rc.conf | 1 +
etc/rc | 21 +++++++++++++++------
share/man/man5/rc.conf.5 | 7 +++++++
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 93a4d4fcf243..59a910079074 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -33,6 +33,7 @@ removable_interfaces="" # Removable network interfaces for /etc/pccard_ether.
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails.
+background_fsck="YES" # Attempt to run fsck in the background where possible.
##############################################################
### Network configuration sub-section ######################
diff --git a/etc/rc b/etc/rc
index 7283c58276fb..b867d757eaea 100644
--- a/etc/rc
+++ b/etc/rc
@@ -184,9 +184,14 @@ swapon -a
case ${bootmode} in
autoboot)
echo 'Automatic boot in progress...'
-# To restore old fsck behavior use:
-# fsck -p
- fsck -F -p
+ case ${background_fsck} in
+ [Yy][Ee][Ss])
+ fsck -F -p
+ ;;
+ *)
+ fsck -p
+ ;;
+ esac
case $? in
0)
;;
@@ -810,9 +815,13 @@ case ${kern_securelevel_enable} in
;;
esac
-# Start background fsck checks
-echo 'Starting background filesystem checks'
-nice -4 fsck -B -p 2>&1 | logger -p daemon.notice &
+# Start background fsck checks if necessary
+case ${background_fsck} in
+[Yy][Ee][Ss])
+ echo 'Starting background filesystem checks'
+ nice -4 fsck -B -p 2>&1 | logger -p daemon.notice &
+ ;;
+esac
echo ''
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index d69b3e71036f..b2f5be690051 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -625,6 +625,13 @@ if set to
.Xr fsck 8
will be run with the -y flag if the initial preen
of the filesystems fails.
+.It Va background_fsck
+.Pq Vt bool
+if set to
+.Ar YES ,
+the system will attempt to run
+.Xr fsck 8
+in the background where possible.
.It Va syslogd_enable
.Pq Vt bool
If set to