Review request: fixing /usr dependencies in rc.d/var
Brooks Davis
brooks at one-eyed-alien.net
Tue Oct 5 16:22:11 PDT 2004
I'm trying to get the /usr dependencies out of rc.d/var. The patch
below does everything except dealing with mtree (I think we're going to
end up moving mtree to /sbin). This change causes two behavior changes.
- If you delete one of the files now marked with a C, it will come
right back next time you boot unless you remove the C. I don't think
this is a big deal, but it may bite a user or two if they don't use
mergemaster or read UPDATING.
- Second, if you are booting diskless, only the files marked with C's
or those created elsewhere (wtmp, lastlog, sendmail.st) will be
created at boot instead of all the files. The old behavior can be
returned by adding C's to the flags or change newsyslog_flags to -CCN.
Any comments?
-- Brooks
----- Forwarded message from Brooks Davis <brooks at freebsd.org> -----
From: Brooks Davis <brooks at freebsd.org>
Date: Tue, 5 Oct 2004 23:13:13 GMT
To: Perforce Change Reviews <perforce at freebsd.org>
X-Virus-Status: No
Subject: PERFORCE change 62717 for review
http://perforce.freebsd.org/chv.cgi?CH=62717
Change 62717 by brooks at brooks_fellow on 2004/10/05 23:12:25
Reduce the dependencies on /usr in /etc/rc.d/var. This is done
in several parts:
- Move syslog creation to /etc/rc.d/newsyslog and hook
newsyslog up to the build.
- Adding C flags to all syslog files created by
"cd etc; make distribution" so they are created by default.
- Create /var/log/sendmail.st in /etc/rc.d/sendmail.
- Create /var/log/lastlog and /var/log/wtmp /etc/rc.d/sysdb
along side /var/run/utmp.
Affected files ...
.. //depot/user/brooks/cleanup/etc/defaults/rc.conf#20 edit
.. //depot/user/brooks/cleanup/etc/newsyslog.conf#3 edit
.. //depot/user/brooks/cleanup/etc/rc.d/Makefile#16 edit
.. //depot/user/brooks/cleanup/etc/rc.d/newsyslog#2 edit
.. //depot/user/brooks/cleanup/etc/rc.d/sendmail#6 edit
.. //depot/user/brooks/cleanup/etc/rc.d/sysdb#2 edit
.. //depot/user/brooks/cleanup/etc/rc.d/var#4 edit
Differences ...
==== //depot/user/brooks/cleanup/etc/defaults/rc.conf#20 (text+ko) ====
@@ -153,6 +153,9 @@
syslogd_program="/usr/sbin/syslogd" # path to syslogd, if you want a different one.
syslogd_flags="-s" # Flags to syslogd (if enabled).
#syslogd_flags="-ss" # Syslogd flags to not bind an inet socket
+newsyslog_enable="YES" # Run newsyslog at boot (YES/NO)
+newsyslog_program="/usr/sbin/newsyslog" # path to newsyslog.
+newsyslog_flags="-CN" # Newsyslog flags to create marked files
inetd_enable="NO" # Run the network daemon dispatcher (YES/NO).
inetd_program="/usr/sbin/inetd" # path to inetd, if you want a different one.
inetd_flags="-wW -C 60" # Optional flags to inetd
==== //depot/user/brooks/cleanup/etc/newsyslog.conf#3 (text+ko) ====
@@ -19,21 +19,21 @@
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/all.log 600 7 * @T00 J
/var/log/amd.log 644 7 100 * J
-/var/log/auth.log 600 7 100 * J
+/var/log/auth.log 600 7 100 * CJ
/var/log/console.log 600 5 100 * J
-/var/log/cron 600 3 100 * J
+/var/log/cron 600 3 100 * CJ
/var/log/daily.log 640 7 * @T00 JN
-/var/log/debug.log 600 7 100 * J
+/var/log/debug.log 600 7 100 * CJ
/var/log/kerberos.log 600 7 100 * J
-/var/log/lpd-errs 644 7 100 * J
-/var/log/maillog 640 7 * @T00 J
-/var/log/messages 644 5 100 * J
+/var/log/lpd-errs 644 7 100 * CJ
+/var/log/maillog 640 7 * @T00 CJ
+/var/log/messages 644 5 100 * CJ
/var/log/monthly.log 640 12 * $M1D0 JN
/var/log/pflog 600 3 100 * JB /var/run/pflogd.pid
-/var/log/ppp.log root:network 640 3 100 * J
-/var/log/security 600 10 100 * J
+/var/log/ppp.log root:network 640 3 100 * CJ
+/var/log/security 600 10 100 * CJ
/var/log/sendmail.st 640 10 * 168 B
-/var/log/slip.log root:network 640 3 100 * J
+/var/log/slip.log root:network 640 3 100 * CJ
/var/log/weekly.log 640 5 1 $W6D0 JN
/var/log/wtmp 644 3 * @01T05 B
-/var/log/xferlog 600 7 100 * J
+/var/log/xferlog 600 7 100 * CJ
==== //depot/user/brooks/cleanup/etc/rc.d/Makefile#16 (text+ko) ====
@@ -22,7 +22,7 @@
mixer motd mountcritlocal mountcritremote \
mountd moused mroute6d mrouted msgs \
named natd netif netoptions \
- network_ipv6 nfsclient nfsd \
+ network_ipv6 newsyslog nfsclient nfsd \
nfslocking nfsserver nisdomain nsswitch ntpd ntpdate \
othermta \
pccard pcvt pf pflog preseedrandom \
==== //depot/user/brooks/cleanup/etc/rc.d/newsyslog#2 (text+ko) ====
@@ -1,27 +1,19 @@
#!/bin/sh
#
-# $NetBSD: newsyslog,v 1.5 2002/03/24 15:51:26 lukem Exp $
-# $FreeBSD: src/etc/rc.d/newsyslog,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $FreeBSD$
#
# PROVIDE: newsyslog
-# REQUIRE: mountcritremote sysdb
-# BEFORE: syslogd SERVERS
+# REQUIRE: cleanvar mountcritremote
+# BEFORE: syslogd
+# KEYWORD: FreeBSD
. /etc/rc.subr
name="newsyslog"
-rcvar=$name
+start_cmd=${newsyslog_program}
+stop_cmd=":"
required_files="/etc/newsyslog.conf"
-start_cmd="newsyslog_start"
-stop_cmd=":"
-
-newsyslog_start()
-{
- echo -n "Trimming log files:"
- /usr/bin/newsyslog -s $rc_flags
- echo " done."
-}
load_rc_config $name
run_rc_command "$1"
==== //depot/user/brooks/cleanup/etc/rc.d/sendmail#6 (text+ko) ====
@@ -69,6 +69,10 @@
"${name}: /etc/mail/aliases.db not present, generating"
/usr/bin/newaliases
fi
+
+ if [ ! -f "/var/log/sendmail.st" ]; then
+ /usr/bin/touch /var/log/sendmail.st
+ fi
}
run_rc_command "$1"
==== //depot/user/brooks/cleanup/etc/rc.d/sysdb#2 (text+ko) ====
@@ -30,6 +30,15 @@
# not be available then (possibly no /usr).
#
install -c -m 664 -g utmp /dev/null /var/run/utmp
+
+ # Make sure lastlog wtmp exist. They might not be there if
+ # we are booting diskless.
+ if [ ! -f /var/log/lastlog ]; then
+ install -m 644 /dev/null /var/log/lastlog
+ fi
+ if [ ! -f /var/log/wtmp ]; then
+ install -m 644 /dev/null /var/log/wtmp
+ fi
}
load_rc_config $name
==== //depot/user/brooks/cleanup/etc/rc.d/var#4 (text+ko) ====
@@ -48,10 +48,6 @@
;;
esac
- /usr/sbin/newsyslog -CC
-
- /usr/bin/touch /var/log/lastlog
-
# XXX: should create spool dirs for lpd
}
@@ -87,8 +83,7 @@
*)
if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
true
- elif [ ! -x /usr/sbin/mtree -o ! -x /usr/sbin/newsyslog -o \
- ! -x /usr/bin/touch ] ; then
+ elif [ ! -x /usr/sbin/mtree ] ; then
false
else
_populate_var
----- End forwarded message -----
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20041005/ab705232/attachment.bin
More information about the freebsd-rc
mailing list