diff options
author | Matthew Dillon <dillon@FreeBSD.org> | 2002-12-28 18:47:53 +0000 |
---|---|---|
committer | Matthew Dillon <dillon@FreeBSD.org> | 2002-12-28 18:47:53 +0000 |
commit | c8029eccc0b7a4906eae43ce7f7bad25766e1523 (patch) | |
tree | 1014e090aa26a424bd208fcf6850f4644eabd9b5 /etc | |
parent | a6c5babf64c12e1b1dcc00238d52dacfd46df417 (diff) | |
download | src-c8029eccc0b7a4906eae43ce7f7bad25766e1523.tar.gz src-c8029eccc0b7a4906eae43ce7f7bad25766e1523.zip |
Notes
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.diskless1 | 5 | ||||
-rw-r--r-- | etc/rc.diskless2 | 70 |
2 files changed, 52 insertions, 23 deletions
diff --git a/etc/rc.diskless1 b/etc/rc.diskless1 index fad8f86104b4..bc00844653c4 100644 --- a/etc/rc.diskless1 +++ b/etc/rc.diskless1 @@ -152,8 +152,9 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do # NFS remount # if [ -d $j -a -f $j/diskless_remount ]; then - mount_nfs `/bin/cat $j/diskless_remount` $j - chkerr $? "mount_nfs `/bin/cat $j/diskless_remount` $j" + nfspt=`/bin/cat $j/diskless_remount` + mount_nfs $nfspt $j + chkerr $? "mount_nfs $nfspt $j" fi done done diff --git a/etc/rc.diskless2 b/etc/rc.diskless2 index f7a4f74cd012..e4863957f6fc 100644 --- a/etc/rc.diskless2 +++ b/etc/rc.diskless2 @@ -55,16 +55,36 @@ elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi -echo "+++ mount_md of /var" -mount_md ${varsize:=32m} /var 1 +# If we do not have a writable /var, create a memory +# filesystem for /var. We don't have /usr yet so +# use mkdir instead of touch to test. We want mount +# to record its mounts so we have to make sure /var/db +# exists before doing the mount -a. +# +if (/bin/mkdir /var/.diskless 2> /dev/null); then + rmdir /var/.diskless +else + echo "+++ mount_md of /var" + mount_md ${varsize:=32m} /var 1 +fi + +if [ ! -d /var/db ]; then + mkdir /var/db +fi +# Now we need the rest of our mounts, particularly /usr +# +mount -a # chown and chgrp are in /usr + +# Populate /var +# echo "+++ populate /var using /etc/mtree/BSD.var.dist" -/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var +/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null case ${sendmail_enable} in [Nn][Oo][Nn][Ee]) ;; *) - /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / + /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null ;; esac @@ -77,34 +97,42 @@ fi 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 -fi - -# -# XXX make sure to create one dir for each printer as requested by lpd +# Make sure our aliases database is uptodate, the aliases may have +# been overriden in /conf. # +/usr/bin/newaliases -# If /tmp is a symlink, assume it points to somewhere writable, like -# /var/tmp, otherwise, use a small memory filesystem for /tmp. +# XXX make sure to create one dir for each printer as requested by lpd # -# 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 we do not have a writable /tmp, create a memory +# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp, +# then it should already be writable). # -if [ ! -L /tmp ]; then - mount_md ${tmpsize:=64m} /tmp 2 - chmod 01777 /tmp +if (/bin/mkdir /tmp/.diskless 2> /dev/null); then + rmdir /tmp/.diskless +else + if [ -h /tmp ]; then + echo "*** /tmp is a symlink to a non-writable area!" + echo "dropping into shell, ^D to continue anyway." + /bin/sh + else + mount_md ${tmpsize:=20480} /tmp 2 + chmod 01777 /tmp + fi fi if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then # we have DEVFS, no worries... true +elif (/bin/mkdir /dev/.diskless 2> /dev/null); then + # if /dev is writable assume it has already been populated + # via rc.diskless1 + # + rmdir /dev/.diskless else - # extract a list of device entries, then copy them to a writable fs (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) + rm -f /tmp/dev.tmp fi + |