- Move critical filesystem mounting code into a shell function and put

that in rc.subr.
- Support critfs_require_network rc.conf variable.
This commit is contained in:
mellon 1999-03-24 18:59:47 +00:00
parent fce1081120
commit 8572695519
2 changed files with 30 additions and 15 deletions

22
etc/rc
View File

@ -1,4 +1,4 @@
# $NetBSD: rc,v 1.119 1999/03/19 00:35:44 perry Exp $
# $NetBSD: rc,v 1.120 1999/03/24 18:59:47 mellon Exp $
# originally from: @(#)rc 8.2 (Berkeley) 3/17/94
# System startup script run by init on autoboot
@ -105,6 +105,10 @@ if checkyesno lkm && [ -f /etc/rc.lkm ]; then
fi
fi
if ! checkyesno critfs_require_network; then
mount_critical_filesystems
fi
# set hostname, turn on network
echo 'starting network'
sh /etc/netstart
@ -112,19 +116,9 @@ if [ $? -ne 0 ]; then
exit 1
fi
for fs in /usr /var $critical_filesystems; do
mount | (
ismounted=no
while read what _on on _type type; do
if [ $on = $fs ]; then
ismounted=yes
fi
done
if [ $ismounted = no ]; then
mount $fs >/dev/null 2>&1
fi
)
done
if checkyesno critfs_require_network; then
mount_critical_filesystems
fi
# Network Address Translation...
if checkyesno ipnat && [ -f /etc/ipnat.conf ]; then

View File

@ -1,4 +1,4 @@
# $NetBSD: rc.subr,v 1.5 1998/02/28 22:56:11 lukem Exp $
# $NetBSD: rc.subr,v 1.6 1999/03/24 18:59:47 mellon Exp $
# functions used by various rc scripts
#
@ -26,3 +26,24 @@ checkyesno() {
;;
esac
}
#
# mount_critical_filesystems
# Go through the list of critical filesystems, checking each one
# to see if it is mounted, and if it is not, mounting it.
#
mount_critical_filesystems() {
for fs in /usr /var $critical_filesystems; do
mount | (
ismounted=no
while read what _on on _type type; do
if [ $on = $fs ]; then
ismounted=yes
fi
done
if [ $ismounted = no ]; then
mount $fs >/dev/null 2>&1
fi
)
done
}