summaryrefslogtreecommitdiff
path: root/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
diff options
context:
space:
mode:
authorConstantin Musca <constantinx.musca@intel.com>2013-02-04 19:13:20 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 09:36:32 +0000
commit5ce5c3d1226d4a8a4997c63acc1b1b125770d005 (patch)
treec1cdd95c32b7a48f1befa7ddf4a164be92e80469 /meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
parenta9591158962eee1f8ae04168d6256032ecd7bc6b (diff)
downloadopenembedded-core-5ce5c3d1226d4a8a4997c63acc1b1b125770d005.tar.gz
openembedded-core-5ce5c3d1226d4a8a4997c63acc1b1b125770d005.tar.bz2
openembedded-core-5ce5c3d1226d4a8a4997c63acc1b1b125770d005.zip
netbase: split up in netbase and init-ifupdown
- netbase should only include etc-rpc, etc-protocols, etc-services and the hosts file - the init script/configuration files should be in another package (init-ifupdown) [YOCTO #2486] Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot')
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
new file mode 100644
index 0000000000..750c0a98f9
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
@@ -0,0 +1,39 @@
+#! /bin/sh
+
+# In case the interface is used as nfsroot, avoid ifup, otherwise
+# nfsroot may lose response
+
+nfsroot=0
+
+if test "x$IFACE" = xlo ; then
+ exit 0
+fi
+
+exec 9<&0 < /proc/mounts
+while read dev mtpt fstype rest; do
+ if test $mtpt = "/" ; then
+ case $fstype in
+ nfs | nfs4)
+ nfsroot=1
+ nfs_addr=`echo $rest | sed -e 's/^.*addr=\([0-9.]*\).*$/\1/'`
+ break
+ ;;
+ *)
+ ;;
+ esac
+ fi
+done
+exec 0<&9 9<&-
+
+test $nfsroot -eq 0 && exit 0
+
+if [ -x /bin/ip -o -x /sbin/ip ] ; then
+ nfs_iface=`ip route get $nfs_addr | grep dev | sed -e 's/^.*dev \([-a-z0-9.]*\).*$/\1/'`
+fi
+
+if test "x$IFACE" = "x$nfs_iface" ; then
+ echo "ifup skipped for nfsroot interface $nfs_iface"
+ exit 1
+fi
+
+exit 0