On Thu, Feb 21, 2002 at 08:00:51PM -0800, David O'Brien wrote: > The use of an MFS /var should also be settable. Otherwise installing > ports(packages) is just a total PITA.
Below is a patch I'd like to commit that may solve this problem in most cases. This patch does the following: - Makes creation of MFS /tmp and /var dependent on them being read-only. It might be useful to make this configurable in rc.conf, but I'm having a hard time coming up with a reasionable configuration this test will break. - Add pre and post hooks to the file in the spirit of the ones in /sbin/dhclient-script. I'm using the pre hook to automaticly decide if the local disk on my machines has the right layout and using Warner's diskprep script to rebuild it if needed. Any comments, suggestions, objections? I'd like to commit in a couple days. -- Brooks Index: rc.diskless2 =================================================================== RCS file: /usr/cvs/src/etc/rc.diskless2,v retrieving revision 1.17 diff -u -r1.17 rc.diskless2 --- rc.diskless2 23 Feb 2002 01:49:20 -0000 1.17 +++ rc.diskless2 1 Mar 2002 21:53:54 -0000 @@ -55,8 +55,20 @@ . /etc/rc.conf fi -echo "+++ mount_md of /var" -mount_md ${varsize:=32m} /var 1 +# Invoke an optional pre mount script +if [ -r /etc/rc.diskless2_pre ]; then + . /etc/rc.diskless2_pre +fi + +mount -a # chown, chgrp, and touch are in /usr + +# Create /var as a memory file system if needed +if /usr/bin/touch /var/_writable_test; then + rm /var/_writable_test +else + echo "+++ mount_md of /var" + mount_md ${varsize:=32m} /var 1 +fi echo "+++ populate /var using /etc/mtree/BSD.var.dist" /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var @@ -70,8 +82,6 @@ echo "+++ create lastlog" /usr/bin/touch /var/log/lastlog -mount -a # chown and chgrp are in /usr - # Since we are starting with a very fresh /etc on an MFS: if [ -d /conf/default/etc ]; then newaliases @@ -81,13 +91,14 @@ # XXX make sure to create one dir for each printer as requested by lpd # -# If /tmp is a symlink, assume it points to somewhere writable, like -# /var/tmp, otherwise, use a small memory filesystem for /tmp. +# If /tmp is not writable, use a small memory filesystem for /tmp. # # XXX: mtree runs too early to create any directories needed in /tmp, # so if /var/tmp == /tmp, then you don't get a vi.recover. # -if [ ! -h /tmp ]; then +if /usr/bin/touch /tmp/_writable_test; then + rm /tmp/_writable_test +else mount_md ${tmpsize:=64m} /tmp 2 chmod 01777 /tmp fi @@ -100,4 +111,9 @@ (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp mount_md 4096 /dev 3 512 (cd /; cpio -i -H newc -d < /tmp/dev.tmp) +fi + +# Invoke an optional post mount script +if [ -r /etc/rc.diskless2_post ]; then + . /etc/rc.diskless2_post fi -- 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
msg35567/pgp00000.pgp
Description: PGP signature