Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Oct 2004 16:27:14 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        rc@freebsd.org
Subject:   Review request: fixing /usr dependencies in rc.d/var
Message-ID:  <20041005232714.GA18350@odin.ac.hmc.edu>

next in thread | raw e-mail | index | archive | help

--liOOAslEiF7prFVr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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@freebsd.org> -----

From: Brooks Davis <brooks@freebsd.org>
Date: Tue, 5 Oct 2004 23:13:13 GMT
To: Perforce Change Reviews <perforce@freebsd.org>
X-Virus-Status: No
Subject: PERFORCE change 62717 for review

http://perforce.freebsd.org/chv.cgi?CH=3D62717

Change 62717 by brooks@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 ...

=2E. //depot/user/brooks/cleanup/etc/defaults/rc.conf#20 edit
=2E. //depot/user/brooks/cleanup/etc/newsyslog.conf#3 edit
=2E. //depot/user/brooks/cleanup/etc/rc.d/Makefile#16 edit
=2E. //depot/user/brooks/cleanup/etc/rc.d/newsyslog#2 edit
=2E. //depot/user/brooks/cleanup/etc/rc.d/sendmail#6 edit
=2E. //depot/user/brooks/cleanup/etc/rc.d/sysdb#2 edit
=2E. //depot/user/brooks/cleanup/etc/rc.d/var#4 edit

Differences ...

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/defaults/rc.conf#20 (text+ko) =
=3D=3D=3D=3D

@@ -153,6 +153,9 @@
 syslogd_program=3D"/usr/sbin/syslogd" # path to syslogd, if you want a dif=
ferent one.
 syslogd_flags=3D"-s"		# Flags to syslogd (if enabled).
 #syslogd_flags=3D"-ss"		# Syslogd flags to not bind an inet socket
+newsyslog_enable=3D"YES"		# Run newsyslog at boot (YES/NO)
+newsyslog_program=3D"/usr/sbin/newsyslog"	# path to newsyslog.
+newsyslog_flags=3D"-CN"		# Newsyslog flags to create marked files
 inetd_enable=3D"NO"		# Run the network daemon dispatcher (YES/NO).
 inetd_program=3D"/usr/sbin/inetd"	# path to inetd, if you want a different=
 one.
 inetd_flags=3D"-wW -C 60"		# Optional flags to inetd

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/newsyslog.conf#3 (text+ko) =3D=
=3D=3D=3D

@@ -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

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/rc.d/Makefile#16 (text+ko) =3D=
=3D=3D=3D

@@ -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 \

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/rc.d/newsyslog#2 (text+ko) =3D=
=3D=3D=3D

@@ -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$
 #
=20
 # PROVIDE: newsyslog
-# REQUIRE: mountcritremote sysdb
-# BEFORE:  syslogd SERVERS
+# REQUIRE: cleanvar mountcritremote
+# BEFORE: syslogd
+# KEYWORD: FreeBSD
=20
 . /etc/rc.subr
=20
 name=3D"newsyslog"
-rcvar=3D$name
+start_cmd=3D${newsyslog_program}
+stop_cmd=3D":"
 required_files=3D"/etc/newsyslog.conf"
-start_cmd=3D"newsyslog_start"
-stop_cmd=3D":"
-
-newsyslog_start()
-{
-	echo -n "Trimming log files:"
-	/usr/bin/newsyslog -s $rc_flags
-	echo " done."
-}
=20
 load_rc_config $name
 run_rc_command "$1"

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/rc.d/sendmail#6 (text+ko) =3D=
=3D=3D=3D

@@ -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
 }
=20
 run_rc_command "$1"

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/rc.d/sysdb#2 (text+ko) =3D=3D=
=3D=3D

@@ -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
 }
=20
 load_rc_config $name

=3D=3D=3D=3D //depot/user/brooks/cleanup/etc/rc.d/var#4 (text+ko) =3D=3D=3D=
=3D

@@ -48,10 +48,6 @@
 		;;
 	esac
=20
-	/usr/sbin/newsyslog -CC
-
-	/usr/bin/touch /var/log/lastlog
-
 	# XXX: should create spool dirs for lpd
 }
=20
@@ -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 -----
--=20
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

--liOOAslEiF7prFVr
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBYy3RXY6L6fI4GtQRAgsHAJ97hIjEyNukZ0b1PHKZ9U6N10Nx7QCfRDYk
basA9HqIOuWzY+FcG7k9nWk=
=3TLI
-----END PGP SIGNATURE-----

--liOOAslEiF7prFVr--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041005232714.GA18350>