[SM-Commit] GIT changes to master grimoire by Andraž Levstik (4ed5508ff4895189bf86fd559b40c04623584b18)

Andraž Levstik scm at sourcemage.org
Fri Feb 27 13:21:51 EST 2009


GIT changes to master grimoire by Andraž Levstik <ruskie at codemages.net>:

 smgl/init.d/CONFIGURE           |    2 -
 smgl/init.d/DETAILS             |    2 -
 smgl/init.d/HISTORY             |    6 ++++
 smgl/init.d/init.d/devices      |   59 +++++++++++++++++++++++++++++++++++++---
 smgl/init.d/init.d/devices.conf |    2 -
 5 files changed, 65 insertions(+), 6 deletions(-)

New commits:
commit 4ed5508ff4895189bf86fd559b40c04623584b18
Author: Andraž Levstik <ruskie at codemages.net>
Commit: Andraž Levstik <ruskie at codemages.net>

    init.d: added new option static_udev to allow using udev without ramfs/tmpfs

diff --git a/smgl/init.d/CONFIGURE b/smgl/init.d/CONFIGURE
index dbb7fc5..8cd60ac 100755
--- a/smgl/init.d/CONFIGURE
+++ b/smgl/init.d/CONFIGURE
@@ -5,7 +5,7 @@ local  DEVICES_LIST  &&
 if  [[ $(get_sorcery_kernel_config CONFIG_NET) == y  &&
        $(get_sorcery_kernel_config CONFIG_UNIX) == y  &&
        $(get_sorcery_kernel_config CONFIG_HOTPLUG) == y ]]; then
-  DEVICES_LIST="udev static"
+  DEVICES_LIST="udev static static_udev"
 else
   DEVICES_LIST="static"
 fi  &&
diff --git a/smgl/init.d/DETAILS b/smgl/init.d/DETAILS
index 141af49..71793bc 100755
--- a/smgl/init.d/DETAILS
+++ b/smgl/init.d/DETAILS
@@ -1,5 +1,5 @@
            SPELL=init.d
-         VERSION=2.2.5
+         VERSION=2.2.6
       LICENSE[0]=GPL
      GATHER_DOCS=off
 SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
diff --git a/smgl/init.d/HISTORY b/smgl/init.d/HISTORY
index a8c6a16..3837613 100644
--- a/smgl/init.d/HISTORY
+++ b/smgl/init.d/HISTORY
@@ -1,3 +1,9 @@
+2009-02-27 Andraž "ruskie" Levstik <ruskie at mages.ath.cx>
+	* init.d/devices: added static_udev option
+	* init.d/devices.conf: added static_udev option
+	* CONFIGURE: added static_udev option
+	* DETAILS: 2.2.6
+
 2008-12-08 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* DETAILS: define SOURCE_DIRECTORY
 
diff --git a/smgl/init.d/init.d/devices b/smgl/init.d/init.d/devices
index 8fb142b..bb509cc 100755
--- a/smgl/init.d/init.d/devices
+++ b/smgl/init.d/init.d/devices
@@ -29,9 +29,6 @@ start_devfs()
 start_udev()
 { (
   . /etc/udev/udev.conf
-  # mount sysfs
-  echo "Mounting sysfs at /sys"
-  mount -n -t sysfs none /sys
   echo "Mounting ramfs at $udev_root"
   mount -n -t ramfs none $udev_root
   # create some needed stuff
@@ -84,6 +81,59 @@ start_udev()
   kill -USR1 1
 ) }
 
+start_static_udev()
+{ (
+  . /etc/udev/udev.conf
+  # create some needed stuff - and insist on it
+  if [ ! -d $udev_root/fd ]; then
+    ln -fs /proc/self/fd $udev_root/fd
+  fi
+  ln -fs /dev/fd/0 $udev_root/stdin
+  ln -fs /dev/fd/1 $udev_root/stdout
+  ln -fs /dev/fd/2 $udev_root/stderr
+  mkdir -p $udev_root/shm
+  mkdir -p $udev_root/pts
+
+  # strip out kernel sublevel and patchlevel so we can check against them
+  # since we don't support 1.x linux kernels then we don't have to check that
+  PATCHLEVEL=$(uname -r | cut -d. -f2)
+  SUBLEVEL=$(uname -r | cut -d. -f3)
+  tmp=$(uname -r | cut -d. -f3 | sed 's/^[0-9]*//g')
+  SUBLEVEL=${SUBLEVEL/$tmp/}
+
+  # kernel 2.6.15-rc1 and higher don't use hotplug
+  if [ $SUBLEVEL -ge 15 -a $PATCHLEVEL -ge 6 ]; then
+    echo "don't need hotplug for this kernel"
+    builtin echo > /proc/sys/kernel/hotplug
+  else
+      # Now uses udevsend as the hotplug multiplexer
+    echo "Setting udevsend as hotplug agent"
+    sysctl -w kernel.hotplug="/sbin/udevsend" > /dev/null 2>&1
+    echo "Creating initial udev device nodes"
+    /sbin/udevstart
+  fi
+
+  if [ -f /etc/udev/udev.missing ]; then
+    echo "Processing /etc/udev/udev.missing"
+    cd /dev
+    while read line; do
+      if [ "${line:0:1}" == "#" ]; then continue; fi
+      for ((i=0; i<7; i++)); do
+        val[$i]=${line%%:*}
+        line=${line#*:}
+      done
+      if [ "${val[1]}" == "d" ]; then
+        mkdir -p ${val[0]}
+      else
+        mknod ${val[0]} ${val[1]} ${val[2]} ${val[3]}
+      fi
+      chmod ${val[4]} ${val[0]}
+      chown ${val[5]}:${val[6]} ${val[0]}
+    done < /etc/udev/udev.missing
+    cd /
+  fi
+) }
+
 start_static()
 {
    exit 0
@@ -94,6 +144,9 @@ start()
   # mount proc
   echo "Mounting /proc"
   mount -n -t proc proc /proc
+  # mount sys
+  echo "Mounting /sys"
+  mount -n -t sysfs sysfs /sys
   eval "start_$DEVICES"
 }
 
diff --git a/smgl/init.d/init.d/devices.conf b/smgl/init.d/init.d/devices.conf
index 287f0cc..aefd80b 100644
--- a/smgl/init.d/init.d/devices.conf
+++ b/smgl/init.d/init.d/devices.conf
@@ -1,2 +1,2 @@
-# type of device management, "static", "devfs" or "udev"
+# type of device management, "static", "devfs", "udev" or "static_udev"
 DEVICES=devfs



More information about the SM-Commit mailing list