summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-08-10 19:53:50 +0000
committerbrian <brian@FreeBSD.org>1998-08-10 19:53:50 +0000
commit652b094a95f7ad25731b5e1285012b722994cd74 (patch)
treed1b1dad0f83eda08612457fccf849c5c3d2ffa16 /etc
parenta3bd064578abbae40d64caf43915257570710b03 (diff)
downloadFreeBSD-src-652b094a95f7ad25731b5e1285012b722994cd74.zip
FreeBSD-src-652b094a95f7ad25731b5e1285012b722994cd74.tar.gz
Don't blat /var/run and /var/spool/lock *after* network_pass1()
unless /var is nfs-mounted. This was removing ppps device lock (when ppp's started in /etc/start_if.tun0 in -ddial or -dedicated mode) and allowing other programs (such as mgetty) to confuse ppp by playing with the modem while ppp's using it. People that nfs-mount /var had better not start ppp in this way....
Diffstat (limited to 'etc')
-rw-r--r--etc/rc31
1 files changed, 23 insertions, 8 deletions
diff --git a/etc/rc b/etc/rc
index 9268d60..6c5a9e7 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: rc,v 1.146 1998/06/22 06:34:12 jkoshy Exp $
+# $Id: rc,v 1.147 1998/07/28 01:15:12 nectar Exp $
# From: @(#)rc 5.27 (Berkeley) 6/5/91
# System startup script run by init on autoboot
@@ -95,10 +95,25 @@ fi
adjkerntz -i
-rm -rf /var/run/*
-
-# Keep a copy of the boot messages around
-dmesg > /var/run/dmesg.boot
+clean_var() {
+ if [ ! -f /var/run/clean_var ]; then
+ rm -rf /var/run/*
+ rm -f /var/spool/lock/*
+ rm -rf /var/spool/uucp/.Temp/*
+ # Keep a copy of the boot messages around
+ dmesg >/var/run/dmesg.boot
+ # And an initial utmp file
+ (cd /var/run && cp /dev/null utmp && chmod 644 utmp; )
+ touch /var/run/clean_var
+ fi
+}
+
+if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
+ # network_pass1() *may* end up writing stuff to /var - we don't want to
+ # remove it immediately afterwards - *nor* to we want to fail to clean
+ # an nfs-mounted /var.
+ clean_var
+fi
# Add additional swapfile, if configured.
if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then
@@ -129,9 +144,9 @@ chmod 666 /dev/tty[pqrsPQRS]*
# clean up left-over files
rm -f /etc/nologin
-rm -f /var/spool/lock/*
-rm -rf /var/spool/uucp/.Temp/*
-(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })
+
+clean_var # If it hasn't already been done
+rm /var/run/clean_var
#
# Clearing /tmp at boot-time seems to have a long tradition. It doesn't
OpenPOWER on IntegriCloud