changeset 833:18fa21056b01

System Images' sbin/init.sh should mount /dev/hdc (if it exists) on /mnt, and then run /mnt/init (instead of a shell prompt) if that exists.
author Rob Landley <rob@landley.net>
date Fri, 02 Oct 2009 02:12:47 -0500
parents fc498452494a
children 47f699f5f143
files root-filesystem.sh sources/native/sbin/init.sh
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/root-filesystem.sh	Fri Oct 02 00:56:05 2009 -0500
+++ b/root-filesystem.sh	Fri Oct 02 02:12:47 2009 -0500
@@ -36,7 +36,7 @@
 if [ -z "$ROOT_NODIRS" ]
 then
   ROOT_TOPDIR="$STAGE_DIR/usr"
-  mkdir -p "$STAGE_DIR"/{tmp,proc,sys,dev,home} || dienow
+  mkdir -p "$STAGE_DIR"/{tmp,proc,sys,dev,home,mnt} || dienow
   for i in bin sbin lib etc
   do
     mkdir -p "$ROOT_TOPDIR/$i" || dienow
--- a/sources/native/sbin/init.sh	Fri Oct 02 00:56:05 2009 -0500
+++ b/sources/native/sbin/init.sh	Fri Oct 02 02:12:47 2009 -0500
@@ -36,10 +36,23 @@
     mount -o noatime $HOMEDEV /home
   fi
 
+  [ -b /dev/hdc ] && MNTDEV=/dev/hdc
+  [ -b /dev/sdc ] && MNTDEV=/dev/sdc
+  if [ ! -z "$MNTDEV" ]
+  then
+    mount -o ro $MNTDEV /mnt
+  fi
+
   mount -t tmpfs /tmp /tmp
 
+  CONSOLE="$(dmesg |
+    sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')"
+
   echo Type exit when done.
-  exec /bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /bin/ash
+
+  HANDOFF=/bin/ash
+  [ -e /mnt/init ] && HANDOFF=/mnt/init
+  exec /bin/oneit -c /dev/"$CONSOLE" "$HANDOFF"
 
 # If we're not PID 1, it's probably a chroot.
 else