Re: REVIEW: cleanvar.patch

From: Brooks Davis <brooks_at_one-eyed-alien.net>
Date: Mon, 19 Jan 2004 13:20:20 -0800
You might want to post this to the FreeBSD-rc list
(freebsd-rc_at_yahoogroups.com).

On Mon, Jan 19, 2004 at 09:49:19PM +0100, Poul-Henning Kamp wrote:
> 
> 
> This patch adds code which detects an read-only /var and puts
> a MD(4) disk on it in that case.
> 
> This is really a move of some diskless specific code to the
> more general use of read-only rootfs systems.

Overall this seems like a good idea.  I'm not sure cleanvar is the right
place (as opposed to a new script cleanvar depends on), but this is
probably as good as any.

> +# Provide a function for normalizing the mounting of memory
> +# filesystems.  This should allow the rest of the code here to remain
> +# as close as possible between 5-current and 4-stable.
> +#   $1 = size
> +#   $2 = mount point
> +#   $3 = (optional) bytes-per-inode
> +mount_md() {
> +	if [ -n "$3" ]; then
> +		bpi="-i $3"
> +	fi
> +	/sbin/mdmfs $bpi -s $1 -M md $2
> +}

Since this would now appear in three files, maybe it should go in
/etc/rc.subr.

> +# Populate /var if it looks empty
> +if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
> +	true
> +else
> +	/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null 2>&1

You also need to create the sendmail files if sendmail is enabled:

case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
	;;
*)
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
	;;
esac


> +	LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf`
> +	if [ -n "$LOGFILES" ]; then
> +		/usr/bin/touch $LOGFILES
> +	fi

It's kind of lame that we have to do this when newsyslog has the -CC
option.  I guess we're stuck with it given we don't have /usr yet.

> +	/usr/bin/touch /var/log/lastlog
> +
> +fi

-- Brooks

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

Received on Mon Jan 19 2004 - 12:20:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:39 UTC