[oe-commits] Leon Woestenberg : netbase/init: Do not run 'ifup -a' if root is network mounted.

git version control git at git.openembedded.org
Sat Jan 2 16:14:42 UTC 2010


Module: openembedded.git
Branch: martin_jansa/srcpv
Commit: 26af5ed1db81d29a59eb93cd9860d246d8dfa6a2
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=26af5ed1db81d29a59eb93cd9860d246d8dfa6a2

Author: Leon Woestenberg <leon at sidebranch.com>
Date:   Tue Dec 29 23:49:18 2009 +0100

netbase/init: Do not run 'ifup -a' if root is network mounted.

'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 at sidebranch.com>

---

 recipes/netbase/netbase/init |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/recipes/netbase/netbase/init b/recipes/netbase/netbase/init
index acc26cb..227f6ff 100644
--- a/recipes/netbase/netbase/init
+++ b/recipes/netbase/netbase/init
@@ -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





More information about the Openembedded-commits mailing list