Date: Tue, 27 May 2003 13:54:02 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: hackers@freebsd.org Subject: rc.diskless1/initdiskless change for review Message-ID: <20030527205402.GA30952@Odin.AC.HMC.Edu>
next in thread | raw e-mail | index | archive | help
--cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The following patch (against rc.diskless1 on STABLE, but the code is identical in rc.d/initdiskless) simplifies the likely common case for remounts in the /conf hierarchy. It allows you to specify a path (i.e. /etc) in the diskless_remount file rather then having to record the path to the NFS root. I'm using this to allow me to copy a the entire root to a new location on my NFS server to do an upgrade without breaking running hosts on the old root and without touching /conf at all. I'd like to commit this after the tree is thawed again. What do people think? -- Brooks Index: rc.diskless1 =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/Attic/rc.diskless1,v retrieving revision 1.5.2.11 diff -u -r1.5.2.11 rc.diskless1 --- rc.diskless1 14 Apr 2003 18:12:05 -0000 1.5.2.11 +++ rc.diskless1 24 May 2003 00:33:19 -0000 @@ -121,6 +121,17 @@ done echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipb= ca}" =20 +# Figure out our NFS root path +# +set `mount -t nfs` +while [ $# -ge 1 ] ; do + if [ "$2" =3D "on" -a "$3" =3D "/" ]; then + nfsroot=3D"$1" + break + fi + shift +done + # Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca}, # and /conf/${bootp_ipa}. For each subdirectory found within these=20 # directories: @@ -136,6 +147,10 @@ # might contain 'myserver:/etc'. NFS remounts allow you to avoid # having to dup your system directories in /conf. Your server must # be sure to export those filesystems -alldirs, however. +# If the diskless_remount file contains a string beginning with a +# '/' it is assumed that the local nfsroot should be prepended to +# it before attemping to mount allowing the root to be relocated +# without needing to change the remount files. # for i in base default ${bootp_ipbca} ${bootp_ipa} ; do for j in /conf/$i/* ; do @@ -150,6 +165,9 @@ # if [ -d $j -a -f $j/diskless_remount ]; then nfspt=3D`/bin/cat $j/diskless_remount` + if [ `expr "$nfspt" : '\(.\)'` =3D "/" ]; then + nfspt=3D"${nfsroot}${nfspt}" + fi mount_nfs $nfspt $j chkerr $? "mount_nfs $nfspt $j" 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 --cWoXeonUoKmBZSoM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+09BpXY6L6fI4GtQRArfNAKDK/qwFPD4ZFibqWWr7MbsK45UuTgCfaVK7 IonXDf2sYgvvu8d9YbnTQSI= =xh51 -----END PGP SIGNATURE----- --cWoXeonUoKmBZSoM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030527205402.GA30952>