From 86de41e6561c1bb93c982537c87446371f8279b7 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Mon, 26 Apr 2010 12:11:12 +0200 Subject: [PATCH] diskless: Miscellaneous fixes. * Increase the space reserved for /etc whose size has grown considerably due to the blacklists in /etc/ssh. * Remove the check for devfs which has been around long enough. * Use tmpfs instead of mfs. * Pass whatever is in md_size (e.g. 10M) directly to mount_tmpfs. For backwards compatibility, treat number-only values as sectors (i.e., multiply by 512 and pass that to mount_tmpfs). Submitted-by: Rumko Dragonfly-bug: --- etc/rc.d/diskless | 25 +++---------------------- etc/rc.d/initdiskless | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/etc/rc.d/diskless b/etc/rc.d/diskless index bb36de42b7..ed9f8c5fd0 100644 --- a/etc/rc.d/diskless +++ b/etc/rc.d/diskless @@ -45,12 +45,8 @@ name="diskless" # Provide a function for normalizing the mounting of memory filesystems. # $1 = size # $2 = mount point -# $3 = (optional) bytes-per-inode mount_md() { - if [ -n "$3" ]; then - bpi="-i $3" - fi - /sbin/mount_mfs $bpi -s $1 swap $2 + /sbin/mount_tmpfs -s $1 tmpfs $2 } # If there is a global system configuration file, suck it in. @@ -75,7 +71,7 @@ if (/bin/mkdir /var/.diskless 2> /dev/null); then rmdir /var/.diskless else echo "+++ mount_md of /var" - mount_md ${varsize:=32768} /var + mount_md ${varsize:=16M} /var fi if [ ! -d /var/db ]; then @@ -121,26 +117,11 @@ else echo "dropping into shell, ^D to continue anyway." /bin/sh else - mount_md ${tmpsize:=20480} /tmp + mount_md ${tmpsize:=10M} /tmp chmod 01777 /tmp fi fi -if sysctl vfs.devfs > /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.d/diskless - # - rmdir /dev/.diskless -else - (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp - mount_md 4096 /dev 512 - (cd /; cpio -i -H newc -d < /tmp/dev.tmp) - rm -f /tmp/dev.tmp -fi - # generate our hostname # if [ -z "`hostname -s`" ]; then diff --git a/etc/rc.d/initdiskless b/etc/rc.d/initdiskless index 4c0798d4c8..8a63b32b03 100644 --- a/etc/rc.d/initdiskless +++ b/etc/rc.d/initdiskless @@ -105,7 +105,7 @@ chkerr() { # Create a generic memory disk # mount_md() { - /sbin/mount_mfs -i 4096 -s $1 swap $2 + /sbin/mount_tmpfs -s $1 tmpfs $2 } # Create the memory filesystem if it has not already been created @@ -113,9 +113,20 @@ mount_md() { create_md() { if [ "x`eval echo \\$md_created_$1`" = "x" ]; then if [ "x`eval echo \\$md_size_$1`" = "x" ]; then - md_size=4096 + if [ "$1" = "etc" ]; then + md_size=12M + else + md_size=2M + fi else md_size=`eval echo \\$md_size_$1` + + # for backwards compatibility... + # if it's a number, then treat it as number of sectors + # + if [ "$md_size" = "${md_size%%[!0-9]*}" ]; then + md_size=`expr $md_size '*' 512` + fi fi mount_md $md_size /$1 /bin/chmod 755 /$1 -- 2.41.0