diskless: Miscellaneous fixes.
authorSascha Wildner <saw@online.de>
Mon, 26 Apr 2010 10:11:12 +0000 (12:11 +0200)
committerSascha Wildner <saw@online.de>
Mon, 26 Apr 2010 10:11:12 +0000 (12:11 +0200)
* 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 <rumcic@gmail.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1732>

etc/rc.d/diskless
etc/rc.d/initdiskless

index bb36de4..ed9f8c5 100644 (file)
@@ -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
index 4c0798d..8a63b32 100644 (file)
@@ -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