netbase/init: Do not run 'ifup -a' if root is network mounted.
authorLeon Woestenberg <leon@sidebranch.com>
Tue, 29 Dec 2009 22:49:18 +0000 (23:49 +0100)
committerLeon Woestenberg <leon@sidebranch.com>
Fri, 1 Jan 2010 12:22:42 +0000 (13:22 +0100)
'ifup -a' makes a NFS mounted rootfs dissappear underneath us, so
add detection of such rootfs and do not (de)configure.

Signed-off-by: Leon Woestenberg <leon@sidebranch.com>
recipes/netbase/netbase/init

index acc26cb..227f6ff 100644 (file)
@@ -62,17 +62,27 @@ doopt () {
 
 case "$1" in
     start)
-       # /etc/sysctl.conf is preferred
-       if [ ! -f /etc/sysctl.conf ]; then
-         doopt spoofprotect yes
-         doopt syncookies no
-         doopt ip_forward no
-       fi
-
-        echo -n "Configuring network interfaces... "
-        ifup -a
-       echo "done."
-       ;;
+        if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts | 
+          grep -q "^/ nfs$"; then
+            echo "NOT configuring network interfaces: / is an NFS mount"
+        elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |  
+          grep -q "^/ smbfs$"; then
+            echo "NOT configuring network interfaces: / is an SMB mount"
+       elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts | 
+          grep -qE '^(nfs|smbfs|ncp|coda)$'; then
+            echo "NOT configuring network interfaces: network shares still mounted."
+        else
+            echo -n "Configuring network interfaces... "
+            ifup -a
+           echo "done."
+           # /etc/sysctl.conf is preferred
+           if [ ! -f /etc/sysctl.conf ]; then
+             doopt spoofprotect yes
+             doopt syncookies no
+             doopt ip_forward no
+           fi
+      fi
+      ;;
     stop)
         if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts | 
           grep -q "^/ nfs$"; then