Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 2002 15:04:28 -0800
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        current@FreeBSD.ORG
Subject:   Re: changes to rc.diskless*
Message-ID:  <20020301150428.A5746@Odin.AC.HMC.Edu>
In-Reply-To: <20020221200050.A78243@dragon.nuxi.com>; from obrien@FreeBSD.ORG on Thu, Feb 21, 2002 at 08:00:51PM -0800
References:  <20020221200050.A78243@dragon.nuxi.com>

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

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

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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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
=20
-echo "+++ mount_md of /var"
-mount_md ${varsize:=3D32m} /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:=3D32m} /var 1
+fi
=20
 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
=20
-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
 #
=20
-# 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 =3D=3D /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:=3D64m} /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

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

--VS++wcV0S1rZb1Fb
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8gAj7XY6L6fI4GtQRAg5KAJ9UQ8nu91k7prJ01RkTOI5glz8UYQCgqSGv
lowEyywAf8QeYoFRVl98/U0=
=ziW4
-----END PGP SIGNATURE-----

--VS++wcV0S1rZb1Fb--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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