From: Matthew Dillon Date: Thu, 26 Apr 2007 23:34:27 +0000 (+0000) Subject: Fix various paths in rc.d/diskless and friends. X-Git-Tag: v2.0.1~3167 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/abacd09f3b0c031bf3727bbedc5147dc7b5e9854 Fix various paths in rc.d/diskless and friends. Submitted-by: Thomas Nikolajsen --- diff --git a/etc/rc.d/diskless b/etc/rc.d/diskless index eea065df1b..109999cba2 100644 --- a/etc/rc.d/diskless +++ b/etc/rc.d/diskless @@ -25,7 +25,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/diskless,v 1.25 2003/02/15 16:34:14 jhay Exp $ -# $DragonFly: src/etc/rc.d/diskless,v 1.5 2005/11/19 21:47:32 swildner Exp $ +# $DragonFly: src/etc/rc.d/diskless,v 1.6 2007/04/26 23:34:27 dillon Exp $ # # PROVIDE: diskless @@ -40,11 +40,9 @@ fi dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` [ ${dlv:=0} -eq 0 ] && exit 0 -name="diskless2" +name="diskless" -# 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. +# Provide a function for normalizing the mounting of memory filesystems. # $1 = size # $2 = mount point # $3 = (optional) bytes-per-inode @@ -52,7 +50,7 @@ mount_md() { if [ -n "$3" ]; then bpi="-i $3" fi - /sbin/mdmfs $bpi -s $1 -M md $2 + /sbin/mount_mfs $bpi -s $1 swap $2 } # If there is a global system configuration file, suck it in. @@ -77,7 +75,7 @@ if (/bin/mkdir /var/.diskless 2> /dev/null); then rmdir /var/.diskless else echo "+++ mount_md of /var" - mount_md ${varsize:=32m} /var + mount_md ${varsize:=32768} /var fi if [ ! -d /var/db ]; then @@ -138,7 +136,7 @@ if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then true elif (/bin/mkdir /dev/.diskless 2> /dev/null); then # if /dev is writable assume it has already been populated - # via rc.diskless1 + # via rc.d/diskless # rmdir /dev/.diskless else @@ -151,7 +149,7 @@ fi # generate our hostname # if [ -z "`hostname -s`" ]; then - hostname=`/bin/kenv dhcp.host-name` + hostname=`/usr/bin/kenv dhcp.host-name` hostname $hostname echo "Hostname is $hostname" fi @@ -160,11 +158,10 @@ fi # build the resolv.conf # if [ ! -e /etc/resolv.conf ]; then - echo domain `/bin/kenv dhcp.domain-name` > /etc/resolv.conf + echo domain `/usr/bin/kenv dhcp.domain-name` > /etc/resolv.conf - set `/bin/kenv dhcp.domain-name-servers` + set `/usr/bin/kenv dhcp.domain-name-servers` for ns in `IFS=','; echo $*`; do echo nameserver $ns >> /etc/resolv.conf; done fi - diff --git a/etc/rc.d/initdiskless b/etc/rc.d/initdiskless index bcd04affec..f856c0bbbb 100644 --- a/etc/rc.d/initdiskless +++ b/etc/rc.d/initdiskless @@ -25,7 +25,7 @@ # SUCH DAMAGE. # # $FreeBSD: src/etc/rc.d/initdiskless,v 1.24 2003/06/30 21:47:06 brooks Exp $ -# $DragonFly: src/etc/rc.d/initdiskless,v 1.7 2005/11/19 21:47:32 swildner Exp $ +# $DragonFly: src/etc/rc.d/initdiskless,v 1.8 2007/04/26 23:34:27 dillon Exp $ # # PROVIDE: initdiskless @@ -60,10 +60,9 @@ dummy_rc_command "$1" # # If a subdirectory contains the file 'md_size', the contents of the # file is used to determine the size of the memory filesystem, in 512 -# byte sectors. The default is 8192 (4MB). You only have to specify an +# byte sectors. The default is 4096 (2MB). You only have to specify an # md_size if the default doesn't work for you (i.e. if it is too big or -# too small). Note that in -current the default is 4096 (2MB). For -# example, /conf/base/etc/md_size might contain '16384'. +# too small). For example, /conf/base/etc/md_size might contain '16384'. # # If /conf//SUBDIR.cpio.gz exists, the file is cpio'd into # the specified /SUBDIR (and a memory filesystem is created for /SUBDIR @@ -78,7 +77,7 @@ dummy_rc_command "$1" # /conf/default/etc/{rc.conf,rc.local,fstab}. Your fstab should be sure # to mount a /usr... typically an NFS readonly /usr. # -# NOTE! rc.diskless2 will create /var, /tmp, and /dev. Those filesystems +# NOTE! rc.d/diskless will create /var, /tmp, and /dev. Those filesystems # should not be specified in /conf. At least not yet. dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` @@ -106,22 +105,22 @@ chkerr() { # Create a generic memory disk # mount_md() { - /sbin/mdmfs -i 4096 -s $1 -M md $2 + /sbin/mount_mfs -i 4096 -s $1 swap $2 } # Create the memory filesystem if it has not already been created # create_md() { if [ "x`eval echo \\$md_created_$1`" = "x" ]; then - if [ "x`eval echo \\$md_size_$1`" = "x" ]; then - md_size=4096 - else - md_size=`eval echo \\$md_size_$1` + if [ "x`eval echo \\$md_size_$1`" = "x" ]; then + md_size=4096 + else + md_size=`eval echo \\$md_size_$1` + fi + mount_md $md_size /$1 + /bin/chmod 755 /$1 + eval md_created_$1=created fi - mount_md $md_size /$1 - /bin/chmod 755 /$1 - eval md_created_$1=created - fi } # DEBUGGING @@ -168,8 +167,7 @@ done # # - calculate memory filesystem sizes. If the subdirectory (prior to # NFS remounting) contains the file 'md_size', the contents specified -# in 512 byte sectors will be used to size the memory filesystem. Otherwise -# 8192 sectors (4MB) is used. +# in 512 byte sectors will be used to size the memory filesystem. # # - handle NFS remounts. If the subdirectory contains the file # diskless_remount, the contents of the file is NFS mounted over @@ -188,7 +186,7 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do # subdir=${j##*/} if [ -d $j -a -f $j/md_size ]; then - eval md_size_$subdir=`cat $j/md_size` + eval md_size_$subdir=`cat $j/md_size` fi # NFS remount @@ -196,12 +194,12 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do if [ -d $j -a -f $j/diskless_remount ]; then nfspt=`/bin/cat $j/diskless_remount` if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then - nfspt="${nfsroot}${nfspt}" + nfspt="${nfsroot}${nfspt}" fi mount_nfs $nfspt $j chkerr $? "mount_nfs $nfspt $j" fi - done + done done # - Create all required MFS filesystems and populate them from @@ -227,7 +225,7 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do if [ -f $j ]; then create_md $subdir echo "Loading /$subdir from cpio archive $j" - (cd / ; /stand/gzip -d < $j | /stand/cpio --extract -d ) + (cd / ; /usr/bin/gzip -d < $j | /usr/bin/cpio --extract -d ) fi done for j in /conf/$i/*.remove ; do @@ -240,4 +238,3 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do fi done done -