aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
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/init
parenta9591158962eee1f8ae04168d6256032ecd7bc6b (diff)
downloadopenembedded-core-contrib-5ce5c3d1226d4a8a4997c63acc1b1b125770d005.tar.gz
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/init')
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
new file mode 100644
index 0000000000..bace9df991
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
@@ -0,0 +1,89 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides: networking
+# Required-Start: mountvirtfs $local_fs
+# Required-Stop: $local_fs
+# Should-Start: ifupdown
+# Should-Stop: ifupdown
+# Default-Start: S
+# Default-Stop: 0 6
+# Short-Description: Raise network interfaces.
+### END INIT INFO
+
+PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
+
+[ -x /sbin/ifup ] || exit 0
+
+check_network_file_systems() {
+ [ -e /proc/mounts ] || return 0
+
+ if [ -e /etc/iscsi/iscsi.initramfs ]; then
+ echo "not deconfiguring network interfaces: iSCSI root is mounted."
+ exit 0
+ fi
+
+ exec 9<&0 < /proc/mounts
+ while read DEV MTPT FSTYPE REST; do
+ case $DEV in
+ /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+ echo "not deconfiguring network interfaces: network devices still mounted."
+ exit 0
+ ;;
+ esac
+ case $FSTYPE in
+ nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
+ echo "not deconfiguring network interfaces: network file systems still mounted."
+ exit 0
+ ;;
+ esac
+ done
+ exec 0<&9 9<&-
+}
+
+check_network_swap() {
+ [ -e /proc/swaps ] || return 0
+
+ exec 9<&0 < /proc/swaps
+ while read DEV MTPT FSTYPE REST; do
+ case $DEV in
+ /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+ echo "not deconfiguring network interfaces: network swap still mounted."
+ exit 0
+ ;;
+ esac
+ done
+ exec 0<&9 9<&-
+}
+
+case "$1" in
+start)
+ echo -n "Configuring network interfaces... "
+ ifup -a
+ echo "done."
+ ;;
+
+stop)
+ check_network_file_systems
+ check_network_swap
+
+ echo -n "Deconfiguring network interfaces... "
+ ifdown -a
+ echo "done."
+ ;;
+
+force-reload|restart)
+ echo "Running $0 $1 is deprecated because it may not enable again some interfaces"
+ echo "Reconfiguring network interfaces... "
+ ifdown -a || true
+ ifup -a
+ echo "done."
+ ;;
+
+*)
+ echo "Usage: /etc/init.d/networking {start|stop}"
+ exit 1
+ ;;
+esac
+
+exit 0
+