summaryrefslogtreecommitdiffstats
path: root/meta/packages/netbase/netbase
diff options
context:
space:
mode:
authorQing He <qing.he@intel.com>2010-05-19 00:24:25 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-09 16:54:08 +0100
commit601464b4974e46d15abd02efd46663efcd530da8 (patch)
tree30bffdbd2c0b97d55318139afa714c2f0602253b /meta/packages/netbase/netbase
parentbca283671f74b79394e9c332b790e5ed0dc44f35 (diff)
downloadpoky-601464b4974e46d15abd02efd46663efcd530da8.tar.gz
nfsroot: allow nfsroot to survive netbase init
The patch adds a script in /etc/network/if-pre-up.d, the script returns 1 (effectly skip the ifup on the iface) iff: 1. there is a "* / (nfs|nfs4) *" entry in the /proc/mounts 2. the addr field in that entry is routed using $IFACE Signed-off-by: Qing He <qing.he@intel.com>
Diffstat (limited to 'meta/packages/netbase/netbase')
-rw-r--r--meta/packages/netbase/netbase/nfsroot39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/packages/netbase/netbase/nfsroot b/meta/packages/netbase/netbase/nfsroot
new file mode 100644
index 0000000000..fc384a8ea5
--- /dev/null
+++ b/meta/packages/netbase/netbase/nfsroot
@@ -0,0 +1,39 @@
1#! /bin/sh
2
3# In case the interface is used as nfsroot, avoid ifup, otherwise
4# nfsroot may lose response
5
6nfsroot=0
7
8if test "x$IFACE" = xlo ; then
9 exit 0
10fi
11
12exec 9<&0 < /proc/mounts
13while read dev mtpt fstype rest; do
14 if test $mtpt = "/" ; then
15 case $fstype in
16 nfs | nfs4)
17 nfsroot=1
18 nfs_addr=`echo $rest | sed -e 's/^.*addr=\([0-9.]*\).*$/\1/'`
19 break
20 ;;
21 *)
22 ;;
23 esac
24 fi
25done
26exec 0<&9 9<&-
27
28test $nfsroot -eq 0 && exit 0
29
30if test -x /sbin/ip ; then
31 nfs_iface=`ip route get $nfs_addr | grep dev | sed -e 's/^.*dev \([-a-z0-9.]*\).*$/\1/'`
32fi
33
34if test "x$IFACE" = "x$nfs_iface" ; then
35 echo "ifup skipped for nfsroot interface $nfs_iface"
36 exit 1
37fi
38
39exit 0