diff options
author | Constantin Musca <constantinx.musca@intel.com> | 2013-02-04 19:13:20 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-06 09:37:28 +0000 |
commit | 4cb7c9a7ca3632c15414177e6e3ee399ad48ba08 (patch) | |
tree | b69eaf83119f8b92cddd9ce8ad7a99d265668937 /meta/recipes-core/init-ifupdown | |
parent | 7c106a3bb8a427321db579b682adfb4a2bd1eddc (diff) | |
download | poky-4cb7c9a7ca3632c15414177e6e3ee399ad48ba08.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]
(From OE-Core rev: 5ce5c3d1226d4a8a4997c63acc1b1b125770d005)
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')
14 files changed, 272 insertions, 0 deletions
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright new file mode 100644 index 0000000000..2a8e0d1264 --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright | |||
@@ -0,0 +1,11 @@ | |||
1 | This package was created by Peter Tobias tobias@et-inf.fho-emden.de on | ||
2 | Wed, 24 Aug 1994 21:33:28 +0200 and maintained by Anthony Towns | ||
3 | <ajt@debian.org> until 2001. | ||
4 | It is currently maintained by Marco d'Itri <md@linux.it>. | ||
5 | |||
6 | Copyright 1994-2010 Peter Tobias, Anthony Towns and Marco d'Itri | ||
7 | |||
8 | The programs in this package are distributed under the terms of the GNU | ||
9 | General Public License, version 2 as distributed by the Free Software | ||
10 | Foundation. On Debian systems, a copy of this license may be found in | ||
11 | /usr/share/common-licenses/GPL-2. | ||
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 @@ | |||
1 | #!/bin/sh -e | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: networking | ||
4 | # Required-Start: mountvirtfs $local_fs | ||
5 | # Required-Stop: $local_fs | ||
6 | # Should-Start: ifupdown | ||
7 | # Should-Stop: ifupdown | ||
8 | # Default-Start: S | ||
9 | # Default-Stop: 0 6 | ||
10 | # Short-Description: Raise network interfaces. | ||
11 | ### END INIT INFO | ||
12 | |||
13 | PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" | ||
14 | |||
15 | [ -x /sbin/ifup ] || exit 0 | ||
16 | |||
17 | check_network_file_systems() { | ||
18 | [ -e /proc/mounts ] || return 0 | ||
19 | |||
20 | if [ -e /etc/iscsi/iscsi.initramfs ]; then | ||
21 | echo "not deconfiguring network interfaces: iSCSI root is mounted." | ||
22 | exit 0 | ||
23 | fi | ||
24 | |||
25 | exec 9<&0 < /proc/mounts | ||
26 | while read DEV MTPT FSTYPE REST; do | ||
27 | case $DEV in | ||
28 | /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) | ||
29 | echo "not deconfiguring network interfaces: network devices still mounted." | ||
30 | exit 0 | ||
31 | ;; | ||
32 | esac | ||
33 | case $FSTYPE in | ||
34 | nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) | ||
35 | echo "not deconfiguring network interfaces: network file systems still mounted." | ||
36 | exit 0 | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | exec 0<&9 9<&- | ||
41 | } | ||
42 | |||
43 | check_network_swap() { | ||
44 | [ -e /proc/swaps ] || return 0 | ||
45 | |||
46 | exec 9<&0 < /proc/swaps | ||
47 | while read DEV MTPT FSTYPE REST; do | ||
48 | case $DEV in | ||
49 | /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) | ||
50 | echo "not deconfiguring network interfaces: network swap still mounted." | ||
51 | exit 0 | ||
52 | ;; | ||
53 | esac | ||
54 | done | ||
55 | exec 0<&9 9<&- | ||
56 | } | ||
57 | |||
58 | case "$1" in | ||
59 | start) | ||
60 | echo -n "Configuring network interfaces... " | ||
61 | ifup -a | ||
62 | echo "done." | ||
63 | ;; | ||
64 | |||
65 | stop) | ||
66 | check_network_file_systems | ||
67 | check_network_swap | ||
68 | |||
69 | echo -n "Deconfiguring network interfaces... " | ||
70 | ifdown -a | ||
71 | echo "done." | ||
72 | ;; | ||
73 | |||
74 | force-reload|restart) | ||
75 | echo "Running $0 $1 is deprecated because it may not enable again some interfaces" | ||
76 | echo "Reconfiguring network interfaces... " | ||
77 | ifdown -a || true | ||
78 | ifup -a | ||
79 | echo "done." | ||
80 | ;; | ||
81 | |||
82 | *) | ||
83 | echo "Usage: /etc/init.d/networking {start|stop}" | ||
84 | exit 1 | ||
85 | ;; | ||
86 | esac | ||
87 | |||
88 | exit 0 | ||
89 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces new file mode 100644 index 0000000000..0acf4cf441 --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces | |||
@@ -0,0 +1,31 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | # Wireless interfaces | ||
8 | iface wlan0 inet dhcp | ||
9 | wireless_mode managed | ||
10 | wireless_essid any | ||
11 | wpa-driver wext | ||
12 | wpa-conf /etc/wpa_supplicant.conf | ||
13 | |||
14 | iface atml0 inet dhcp | ||
15 | |||
16 | # Wired or wireless interfaces | ||
17 | auto eth0 | ||
18 | iface eth0 inet dhcp | ||
19 | iface eth1 inet dhcp | ||
20 | |||
21 | # Ethernet/RNDIS gadget (g_ether) | ||
22 | # ... or on host side, usbnet and random hwaddr | ||
23 | iface usb0 inet static | ||
24 | address 192.168.7.2 | ||
25 | netmask 255.255.255.0 | ||
26 | network 192.168.7.0 | ||
27 | gateway 192.168.7.1 | ||
28 | |||
29 | # Bluetooth networking | ||
30 | iface bnep0 inet dhcp | ||
31 | |||
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 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # In case the interface is used as nfsroot, avoid ifup, otherwise | ||
4 | # nfsroot may lose response | ||
5 | |||
6 | nfsroot=0 | ||
7 | |||
8 | if test "x$IFACE" = xlo ; then | ||
9 | exit 0 | ||
10 | fi | ||
11 | |||
12 | exec 9<&0 < /proc/mounts | ||
13 | while 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 | ||
25 | done | ||
26 | exec 0<&9 9<&- | ||
27 | |||
28 | test $nfsroot -eq 0 && exit 0 | ||
29 | |||
30 | if [ -x /bin/ip -o -x /sbin/ip ] ; then | ||
31 | nfs_iface=`ip route get $nfs_addr | grep dev | sed -e 's/^.*dev \([-a-z0-9.]*\).*$/\1/'` | ||
32 | fi | ||
33 | |||
34 | if test "x$IFACE" = "x$nfs_iface" ; then | ||
35 | echo "ifup skipped for nfsroot interface $nfs_iface" | ||
36 | exit 1 | ||
37 | fi | ||
38 | |||
39 | exit 0 | ||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces new file mode 100644 index 0000000000..16967763e5 --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces | |||
@@ -0,0 +1,5 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces new file mode 100644 index 0000000000..16967763e5 --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces | |||
@@ -0,0 +1,5 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces new file mode 100644 index 0000000000..16967763e5 --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces | |||
@@ -0,0 +1,5 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces new file mode 100644 index 0000000000..f62b9a897d --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces | |||
@@ -0,0 +1,8 @@ | |||
1 | # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) | ||
2 | |||
3 | # The loopback interface | ||
4 | auto lo | ||
5 | iface lo inet loopback | ||
6 | |||
7 | |||
8 | |||
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb new file mode 100644 index 0000000000..7bc7058a0a --- /dev/null +++ b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb | |||
@@ -0,0 +1,39 @@ | |||
1 | SUMMARY = "Basic TCP/IP networking init scripts and configuration files" | ||
2 | DESCRIPTION = "This package provides high level tools to configure network interfaces" | ||
3 | HOMEPAGE = "http://packages.debian.org/ifupdown" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "GPLv2" | ||
6 | LIC_FILES_CHKSUM = "file://${WORKDIR}/copyright;md5=3dd6192d306f582dee7687da3d8748ab" | ||
7 | PR = "r0" | ||
8 | |||
9 | inherit update-rc.d | ||
10 | |||
11 | INITSCRIPT_NAME = "networking" | ||
12 | INITSCRIPT_PARAMS = "start 40 S . stop 40 0 6 1 ." | ||
13 | |||
14 | SRC_URI = "file://copyright \ | ||
15 | file://init \ | ||
16 | file://interfaces \ | ||
17 | file://nfsroot" | ||
18 | |||
19 | do_install () { | ||
20 | install -d ${D}${sysconfdir}/init.d \ | ||
21 | ${D}${sysconfdir}/network/if-pre-up.d \ | ||
22 | ${D}${sysconfdir}/network/if-up.d \ | ||
23 | ${D}${sysconfdir}/network/if-down.d \ | ||
24 | ${D}${sysconfdir}/network/if-post-down.d | ||
25 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/networking | ||
26 | install -m 0644 ${WORKDIR}/interfaces ${D}${sysconfdir}/network/interfaces | ||
27 | install -m 0755 ${WORKDIR}/nfsroot ${D}${sysconfdir}/network/if-pre-up.d | ||
28 | } | ||
29 | |||
30 | do_install_append_qemuall () { | ||
31 | # Disable network manager on machines that commonly do NFS booting | ||
32 | touch ${D}${sysconfdir}/network/nm-disabled-eth0 | ||
33 | } | ||
34 | |||
35 | PACKAGE_ARCH_qemuall = "${MACHINE_ARCH}" | ||
36 | RDEPENDS_${PN} = "netbase" | ||
37 | RCONFLICTS_${PN} = "netbase (< 1:5.0)" | ||
38 | |||
39 | CONFFILES_${PN} = "${sysconfdir}/network/interfaces" | ||