REVIEW: cleanvar.patch

Brooks Davis brooks at one-eyed-alien.net
Mon Jan 19 13:20:26 PST 2004


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
-------------- 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-current/attachments/20040119/69ad5a06/attachment.bin


More information about the freebsd-current mailing list