diff options
author | Joe Slater <jslater@windriver.com> | 2015-09-01 14:34:29 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-04 16:23:50 +0100 |
commit | bf18f8ad4e71c1fefc0e8bffde4d2f7d36801f8f (patch) | |
tree | e3b505b8608fd42ba7e194993bd4f9fa96316f3f | |
parent | 338c3257f60e99c1fd101d5010daea4099eb1d0e (diff) | |
download | poky-bf18f8ad4e71c1fefc0e8bffde4d2f7d36801f8f.tar.gz |
ifupdown: import recipe
Implements ifup and ifdown.
Copied from https://github.com/WindRiver-OpenSourceLabs/meta-overc.git
as of commit aa89eebffe06e4aa04701eae9691cb3049cbaef9.
(From OE-Core rev: c1d1ccf994d9204f481e12ccb4e63a7c448bc9cd)
Signed-off-by: Joe Slater <jslater@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 214 insertions, 0 deletions
diff --git a/meta/recipes-core/ifupdown/files/99_network b/meta/recipes-core/ifupdown/files/99_network new file mode 100644 index 0000000000..42d5895d75 --- /dev/null +++ b/meta/recipes-core/ifupdown/files/99_network | |||
@@ -0,0 +1 @@ | |||
d root root 0755 /run/network none | |||
diff --git a/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch b/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch new file mode 100644 index 0000000000..8c4d953a28 --- /dev/null +++ b/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From 7af9db748974cb3a2c6ef8f9e03d7db1f9f8ee16 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Gortmaker <paul.gortmaker@windriver.com> | ||
3 | Date: Wed, 6 Aug 2014 14:54:12 -0400 | ||
4 | Subject: [PATCH 1/2] defn2[c|man]: don't rely on dpkg-architecture to set arch | ||
5 | |||
6 | In yocto we'll always be cross compiling, and we'll always | ||
7 | be building on linux for linux (vs. *BSD, hurd, etc.) | ||
8 | |||
9 | Without this the arch is not detected, but it doesn't error | ||
10 | out, and hence you get useless binaries that don't know any | ||
11 | arch specific methods, and the end result will be strangeness | ||
12 | like the loopback device not being configured/enabled. | ||
13 | |||
14 | Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> | ||
15 | --- | ||
16 | defn2c.pl | 6 +++--- | ||
17 | defn2man.pl | 6 +++--- | ||
18 | 2 files changed, 6 insertions(+), 6 deletions(-) | ||
19 | |||
20 | diff --git a/defn2c.pl b/defn2c.pl | ||
21 | index c449de2f3d1c..38845e374c76 100755 | ||
22 | --- a/defn2c.pl | ||
23 | +++ b/defn2c.pl | ||
24 | @@ -2,9 +2,9 @@ | ||
25 | |||
26 | use strict; | ||
27 | |||
28 | -my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; | ||
29 | - | ||
30 | -$DEB_HOST_ARCH_OS =~ s/\n//; | ||
31 | +#my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; | ||
32 | +#$DEB_HOST_ARCH_OS =~ s/\n//; | ||
33 | +my $DEB_HOST_ARCH_OS ="linux"; | ||
34 | |||
35 | # declarations | ||
36 | my $address_family = ""; | ||
37 | diff --git a/defn2man.pl b/defn2man.pl | ||
38 | index 6ddcfdd4fe68..c9c4dd046597 100755 | ||
39 | --- a/defn2man.pl | ||
40 | +++ b/defn2man.pl | ||
41 | @@ -2,9 +2,9 @@ | ||
42 | |||
43 | use strict; | ||
44 | |||
45 | -my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; | ||
46 | - | ||
47 | -$DEB_HOST_ARCH_OS =~ s/\n//; | ||
48 | +#my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; | ||
49 | +#$DEB_HOST_ARCH_OS =~ s/\n//; | ||
50 | +my $DEB_HOST_ARCH_OS = "linux"; | ||
51 | |||
52 | # declarations | ||
53 | my $line; | ||
54 | -- | ||
55 | 1.9.1 | ||
56 | |||
diff --git a/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch b/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch new file mode 100644 index 0000000000..bff352e3af --- /dev/null +++ b/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch | |||
@@ -0,0 +1,103 @@ | |||
1 | From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Gortmaker <paul.gortmaker@windriver.com> | ||
3 | Date: Wed, 6 Aug 2014 15:12:11 -0400 | ||
4 | Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback | ||
5 | |||
6 | Compared to the hurd link.defn for loopback, we see these | ||
7 | are inverted, meaning that you would only be able to configure | ||
8 | a loopback device that was _not_ named "lo" (unlikely to exist). | ||
9 | |||
10 | The result was that we'd update /run/network/ifstate for "lo" | ||
11 | but never actually do anything for up/down, as shown below: | ||
12 | |||
13 | root@localhost:~# ifconfig -s | ||
14 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg | ||
15 | eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU | ||
16 | lo 65536 0 18 0 0 0 18 0 0 0 LRU | ||
17 | root@localhost:~# ifdown lo | ||
18 | root@localhost:~# echo $? | ||
19 | 0 | ||
20 | root@localhost:~# ifconfig -s | ||
21 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg | ||
22 | eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU | ||
23 | lo 65536 0 18 0 0 0 18 0 0 0 LRU | ||
24 | root@localhost:~# ifconfig lo down | ||
25 | root@localhost:~# ifconfig -s | ||
26 | Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg | ||
27 | eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU | ||
28 | root@localhost:~# | ||
29 | |||
30 | Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> | ||
31 | --- | ||
32 | inet.defn | 12 ++++++------ | ||
33 | inet6.defn | 8 ++++---- | ||
34 | 2 files changed, 10 insertions(+), 10 deletions(-) | ||
35 | |||
36 | diff --git a/inet.defn b/inet.defn | ||
37 | index b176ab4ed03e..5fdfb14a0e1c 100644 | ||
38 | --- a/inet.defn | ||
39 | +++ b/inet.defn | ||
40 | @@ -6,10 +6,10 @@ method loopback | ||
41 | This method may be used to define the IPv4 loopback interface. | ||
42 | |||
43 | up | ||
44 | - ip link set dev %iface% up if (!iface_is_lo()) | ||
45 | + ip link set dev %iface% up if (iface_is_lo()) | ||
46 | |||
47 | down | ||
48 | - ip link set dev %iface% down if (!iface_is_lo()) | ||
49 | + ip link set dev %iface% down if (iface_is_lo()) | ||
50 | |||
51 | method static | ||
52 | description | ||
53 | @@ -212,11 +212,11 @@ method loopback | ||
54 | |||
55 | up | ||
56 | ifconfig %iface% 127.0.0.1 up \ | ||
57 | - if (!iface_is_lo()) | ||
58 | + if (iface_is_lo()) | ||
59 | |||
60 | down | ||
61 | ifconfig %iface% down \ | ||
62 | - if (!iface_is_lo()) | ||
63 | + if (iface_is_lo()) | ||
64 | |||
65 | method static | ||
66 | description | ||
67 | @@ -371,11 +371,11 @@ method loopback | ||
68 | |||
69 | up | ||
70 | inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \ | ||
71 | - if (!iface_is_lo()) | ||
72 | + if (iface_is_lo()) | ||
73 | |||
74 | down | ||
75 | inetutils-ifconfig --interface %iface% --down \ | ||
76 | - if (!iface_is_lo()) | ||
77 | + if (iface_is_lo()) | ||
78 | |||
79 | method static | ||
80 | description | ||
81 | diff --git a/inet6.defn b/inet6.defn | ||
82 | index 09325539cd01..4df64aff38cc 100644 | ||
83 | --- a/inet6.defn | ||
84 | +++ b/inet6.defn | ||
85 | @@ -33,11 +33,11 @@ method loopback | ||
86 | description | ||
87 | This method may be used to define the IPv6 loopback interface. | ||
88 | up | ||
89 | - -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo()) | ||
90 | - -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo()) | ||
91 | + -ip link set dev %iface% up 2>/dev/null if (iface_is_lo()) | ||
92 | + -ip addr add dev %iface% ::1 2>/dev/null if (iface_is_lo()) | ||
93 | down | ||
94 | - -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo()) | ||
95 | - -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo()) | ||
96 | + -ip addr del dev %iface% ::1 2>/dev/null if (iface_is_lo()) | ||
97 | + -ip link set dev %iface% down 2>/dev/null if (iface_is_lo()) | ||
98 | |||
99 | method static | ||
100 | description | ||
101 | -- | ||
102 | 1.9.1 | ||
103 | |||
diff --git a/meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb b/meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb new file mode 100644 index 0000000000..e29cc49242 --- /dev/null +++ b/meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb | |||
@@ -0,0 +1,54 @@ | |||
1 | SUMMARY = "ifupdown: basic ifup and ifdown used by initscripts" | ||
2 | DESCRIPTION = "High level tools to configure network interfaces \ | ||
3 | This package provides the tools ifup and ifdown which may be used to \ | ||
4 | configure (or, respectively, deconfigure) network interfaces, based on \ | ||
5 | the file /etc/network/interfaces." | ||
6 | LICENSE = "GPLv2" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | ||
8 | |||
9 | SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/i/ifupdown/ifupdown_0.7.48.1ubuntu5.tar.gz \ | ||
10 | file://defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch \ | ||
11 | file://inet-6-.defn-fix-inverted-checks-for-loopback.patch \ | ||
12 | file://99_network \ | ||
13 | " | ||
14 | |||
15 | EXTRA_OEMAKE = "" | ||
16 | |||
17 | # needed so we don't get default S="${WORKDIR}/ifupdown-${PV}" | ||
18 | S = "${WORKDIR}/ifupdown-${PV}ubuntu5" | ||
19 | |||
20 | |||
21 | inherit update-rc.d | ||
22 | |||
23 | do_compile () { | ||
24 | chmod a+rx *.pl *.sh | ||
25 | oe_runmake 'CC=${CC}' "CFLAGS=${CFLAGS} -Wall -W -D'IFUPDOWN_VERSION=\"${PV}\"'" | ||
26 | } | ||
27 | |||
28 | do_install () { | ||
29 | install -d ${D}${mandir}/man8 \ | ||
30 | ${D}${mandir}/man5 \ | ||
31 | ${D}${base_sbindir} | ||
32 | |||
33 | # If volatiles are used, then we'll also need /run/network there too. | ||
34 | install -d ${D}/etc/default/volatiles | ||
35 | install -m 0644 ${WORKDIR}/99_network ${D}/etc/default/volatiles | ||
36 | |||
37 | install -m 0755 ifup ${D}${base_sbindir}/ | ||
38 | ln ${D}${base_sbindir}/ifup ${D}${base_sbindir}/ifdown | ||
39 | install -m 0644 ifup.8 ${D}${mandir}/man8 | ||
40 | install -m 0644 interfaces.5 ${D}${mandir}/man5 | ||
41 | cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8 | ||
42 | } | ||
43 | |||
44 | ALTERNATIVE_PRIORITY = "100" | ||
45 | ALTERNATIVE_${PN} = "ifup ifdown" | ||
46 | |||
47 | ALTERNATIVE_LINK_NAME[ifup] = "${base_sbindir}/ifup" | ||
48 | ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown" | ||
49 | |||
50 | INITSCRIPT_NAME = "ifup" | ||
51 | INITSCRIPT_PARAMS = "start 39 S . stop 39 0 6 1 ." | ||
52 | |||
53 | SRC_URI[md5sum] = "85ba375f3c6f26d34efb2a8575e77fc8" | ||
54 | SRC_URI[sha256sum] = "08dce14692c07b72b583b86c4d3ace0d9dac1928925144cc3ddde15b694ebbdf" | ||