[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-svn
Subject: [Ipcop-svn] SF.net SVN: ipcop: [1327]
From: chepati () users ! sourceforge ! net
Date: 2008-04-21 1:13:49
Message-ID: E1JnkbN-0003dj-IA () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]
Revision: 1327
http://ipcop.svn.sourceforge.net/ipcop/?rev=1327&view=rev
Author: chepati
Date: 2008-04-20 18:13:49 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
Enabled Olaf's test if the rootfs block device was available and moved some stuff \
into functions so in case the device is not available we 'gracefully' fall into \
rescue mode. Also, not depmod runs inly in install mode.
Modified Paths:
--------------
ipcop/trunk/config/install/init
Modified: ipcop/trunk/config/install/init
===================================================================
--- ipcop/trunk/config/install/init 2008-04-21 01:11:12 UTC (rev 1326)
+++ ipcop/trunk/config/install/init 2008-04-21 01:13:49 UTC (rev 1327)
@@ -46,6 +46,85 @@
# The default init. Can be overwritten by passing init=<something> to the kernel
INIT=/sbin/init
+
+
+#########################################################################################################
+# This is the function we invoke when booting ipcop normally, ie from a hard drive \
installation # +#########################################################################################################
+start_normal_mode()
+{
+ echo "Running in normal mode"
+
+ if [ ! -b ${ROOT} ]; then
+ echo -ne "Waiting for ${ROOT} "
+ COUNT=30
+
+ while [ ! -b ${ROOT} -a ${COUNT} -ge 0 ]
+ do
+ echo -ne "." && sleep 1
+ COUNT=$[ ${COUNT} - 1 ]
+ done
+
+ if [ -b ${ROOT} ]; then
+ echo "Done"
+ else
+ echo "Error"
+ # Something's very wrong, go into rescue mode
+ start_rescue_mode
+ fi
+ fi
+
+ echo -ne "Mounting real rootfs ... "
+ mount -o ro -t ${ROOT_FSTYPE} ${ROOT} /harddisk
+ echo "Done"
+
+ echo -ne "Stopping udevd daemon ... "
+ killall udevd
+ echo "Done"
+
+ echo -ne "Stopping syslogd daemon ... "
+ killall syslogd
+ echo "Done"
+
+ echo -ne "Unmounting /sys ... "
+ umount /sys
+ echo "Done"
+
+ echo "Now switching root ... "
+ exec switch_root /harddisk ${INIT}
+}
+
+
+
+#########################################################################################################
+# This is the function we invoke when installing ipcop #
+#########################################################################################################
+start_install_mode()
+{
+ echo "Running in install mode"
+ export PS1="[${BOLD}install-`uname -m`${NORMAL}] :\w $ "
+ exec busybox init
+}
+
+
+
+#########################################################################################################
+# This is the function we invoke when starting ipcop in rescue/export mode #
+#########################################################################################################
+start_rescue_mode()
+{
+ echo "Running in rescue mode"
+ export PS1="[${BOLD}rescue-`uname -m`${NORMAL}] :\w $ "
+ # Create an alias while in rescue (ie expert) mode
+ #alias start-installer="/bin/iowrap /dev/${CURRENT_TTY} /bin/ash --login -c \
/bin/installer" +
+ # We need this trick so we don't start the installer
+ sed -i "s, -c /bin/installer,,g" /etc/inittab
+ exec busybox init
+}
+
+
+
# Mount /proc first so we know in what mode we booted
echo -ne "Mounting /proc ... "
mount -n -t proc proc /proc
@@ -93,16 +172,18 @@
# Create a link from /proc/mounts to /etc/mtab so mke2fs doesn't fail
ln -sf /proc/mounts /etc/mtab
-# Run depmod to build modules.alias file for hardware detection
-# We only do this on fairly modern machines. For older machines we fall back to \
using the
-# included static modules dependencies files.
-case ${MACHINE} in
- i686|x86_64|ppc|ppc64|sparc64)
- echo -ne "Generating module dependencies. This may take some time ... "
- depmod -a
- echo "Done"
- ;;
-esac
+if [ x"${MODE}" == x"install" ]; then
+ # Run depmod to build modules.alias file for hardware detection
+ # We only do this on fairly modern machines. For older machines we fall back to \
using the + # included static modules dependencies files.
+ case ${MACHINE} in
+ i686|x86_64|ppc|ppc64|sparc64)
+ echo -ne "Generating module dependencies. This may take some time ... "
+ depmod -a
+ echo "Done"
+ ;;
+ esac
+fi
# This is important and it eliminates the need to use udevstart to discover new
# devices after we've loaded a module. And since we're including LFS udev rules
@@ -160,53 +241,19 @@
echo "Done"
fi
-if [ x"${MODE}" == x"normal" ]; then
- echo "Running in normal mode"
- #if [ test ! -b ${ROOT} ]; then
- # echo -ne "Waiting for ${ROOT} "
- # COUNT=30
- # while [ test ! -b ${ROOT} -a ${COUNT} -ge 0 ]
- # do
- # echo -ne "." && sleep 1
- # COUNT=`expr ${COUNT} - 1`
- # done
- # if [ test -b ${ROOT} ]; then
- # echo "Done"
- # else
- # echo "Error"
- # fi
- #fi
- echo -ne "Mounting real rootfs ... "
- mount -o ro -t ${ROOT_FSTYPE} ${ROOT} /harddisk
- echo "Done"
-
- echo -ne "Stopping udevd daemon ... "
- killall udevd
- echo "Done"
-
- echo -ne "Stopping syslogd daemon ... "
- killall syslogd
- echo "Done"
-
- echo -ne "Unmounting /sys ... "
- umount /sys
- echo "Done"
-
- echo "Now switching root ... "
- exec switch_root /harddisk ${INIT}
-elif [ x"${MODE}" == x"install" ]; then
- echo "Running in install mode"
- export PS1="[${BOLD}install-`uname -m`${NORMAL}] :\w $ "
- exec busybox init
-else
- echo "Running in rescue mode"
- export PS1="[${BOLD}rescue-`uname -m`${NORMAL}] :\w $ "
- # Create an alias while in rescue (ie expert) mode
- #alias start-installer="/bin/iowrap /dev/${CURRENT_TTY} /bin/ash --login -c \
/bin/installer"
-
- # We need this trick so we don't start the installer
- sed -i "s, -c /bin/installer,,g" /etc/inittab
- exec busybox init
-fi
+case ${MODE} in
+ normal)
+ start_normal_mode
+ ;;
+ install)
+ start_install_mode
+ ;;
+ rescue|expert)
+ start_rescue_mode
+ ;;
+ *)
+ start_rescue_mode
+ ;;
+esac
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic