rc.diskless1/initdiskless change for review

From: Brooks Davis (brooks_at_one-eyed-alien.net)
Date: 05/27/03

  • Next message: Ashish Kulkarni: "Re: changing the ToS in IP Header"
    Date: Tue, 27 May 2003 13:54:02 -0700
    To: hackers@freebsd.org
    
    
    

    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
    ===================================================================
    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_ipbca}"
     
    +# Figure out our NFS root path
    +#
    +set `mount -t nfs`
    +while [ $# -ge 1 ] ; do
    + if [ "$2" = "on" -a "$3" = "/" ]; then
    + nfsroot="$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
     # 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=`/bin/cat $j/diskless_remount`
    + if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then
    + nfspt="${nfsroot}${nfspt}"
    + fi
                 mount_nfs $nfspt $j
                 chkerr $? "mount_nfs $nfspt $j"
             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
    
    



  • Next message: Ashish Kulkarni: "Re: changing the ToS in IP Header"

    Relevant Pages

    • Re: block root access to NFS mount
      ... I need to give root access to an NFS client host machine, ... Often this also means that root may not even access the nfs filesystem ...
      (Fedora)
    • Re: Problem setting up NFS on Ubuntu
      ... I have installed Ubuntu ... > I used System - Administration - Synaptic Package Manager to include NFS ... Should I be using the GUI, and if so, how do I do that as root, ... and doesn't change the permissions displayed by ls -l ...
      (comp.os.linux.setup)
    • Re: Tools for FreeBSD development
      ... Most typically, the setup involves a central development server running -STABLE, with a private network link to a series of crash boxes. ... The development server NFS exports a file system to use as an NFS root and for file sharing, as well as running tftp and dhcp servers. ... Each test system has its own exported root, so I can use individual loader.conf's to tell test systems to boot off NFS, boot off local disks, etc. ...
      (freebsd-hackers)
    • Re: Tools for FreeBSD development
      ... Most typically, the setup involves a central development server running -STABLE, with a private network link to a series of crash boxes. ... The development server NFS exports a file system to use as an NFS root and for file sharing, as well as running tftp and dhcp servers. ... Each test system has its own exported root, so I can use individual loader.conf's to tell test systems to boot off NFS, boot off local disks, etc. ...
      (freebsd-questions)
    • Re: NFS Security Question
      ... Subject: NFS Security Question ... >If I'm sitting in front of my desktop Sparc, I can always get root. ... you "su -c bob" as root you didn't get bob's Secure RPC key or Kerberos ...
      (Focus-SUN)