aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-10-24 13:39:19 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2013-10-24 11:54:06 +0000
commit5803f98263d7c663e32435751096ecda130d7d13 (patch)
tree235f54af355b5ad8ea9bae6fa24ed17215d7e5e0
parent25438d48f093c2191b63f6100d9442be083e90c2 (diff)
downloadalpine_aports-5803f98263d7c663e32435751096ecda130d7d13.tar.bz2
alpine_aports-5803f98263d7c663e32435751096ecda130d7d13.tar.xz
alpine_aports-5803f98263d7c663e32435751096ecda130d7d13.zip
main/lxc: add various fixes for alpine template and improve init.d messages
fixes #2293 (cherry picked from commit c2c01c0d47d32e99583273d3cb2df0a7253358e9) Conflicts: main/lxc/APKBUILD
-rw-r--r--main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch36
-rw-r--r--main/lxc/0001-lxc-alpine-allow-dev-full.patch33
-rw-r--r--main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch30
-rw-r--r--main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch34
-rw-r--r--main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch33
-rw-r--r--main/lxc/APKBUILD30
-rw-r--r--main/lxc/lxc.initd8
7 files changed, 196 insertions, 8 deletions
diff --git a/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch b/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
new file mode 100644
index 0000000000..432c86c341
--- /dev/null
+++ b/main/lxc/0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
@@ -0,0 +1,36 @@
1From 75b5535282453b3442a41df4a3ba6d3058cd6e48 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 4 Sep 2013 17:01:09 +0200
4Subject: [PATCH] lxc-alpine: add hwaddr for a single macvlan interface
5
6We already add harware address for a single veth interface. Do the same
7with a single macvlan interface.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11---
12 templates/lxc-alpine.in | 8 +++++---
13 1 file changed, 5 insertions(+), 3 deletions(-)
14
15diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
16index 2ab10bb..05aec74 100644
17--- a/templates/lxc-alpine.in
18+++ b/templates/lxc-alpine.in
19@@ -173,9 +173,11 @@ lxc.network.flags = up
20 EOF
21 fi
22
23- # if there is exactly one veth network entry, make sure it has an
24- # associated mac address.
25- nics=$(grep -e '^lxc\.network\.type[ \t]*=[ \t]*veth' $path/config | wc -l)
26+ # if there is exactly one veth or macvlan network entry, make sure
27+ # it has an associated mac address.
28+ nics=$(awk -F '[ \t]*=[ \t]*' \
29+ '$1=="lxc.network.type" && ($2=="veth" || $2=="macvlan") {print $2}' \
30+ $path/config | wc -l)
31 if [ "$nics" -eq 1 ] && ! grep -q "^lxc.network.hwaddr" $path/config; then
32 # see http://sourceforge.net/tracker/?func=detail&aid=3411497&group_id=163076&atid=826303
33 hwaddr="fe:$(dd if=/dev/urandom bs=8 count=1 2>/dev/null |od -t x8 | \
34--
351.8.4.1
36
diff --git a/main/lxc/0001-lxc-alpine-allow-dev-full.patch b/main/lxc/0001-lxc-alpine-allow-dev-full.patch
new file mode 100644
index 0000000000..5abbf22e6b
--- /dev/null
+++ b/main/lxc/0001-lxc-alpine-allow-dev-full.patch
@@ -0,0 +1,33 @@
1From 6bd3f98c469f311f6afbffbb3586efddae3c4eb4 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Tue, 22 Oct 2013 13:23:31 +0200
4Subject: [PATCH] lxc-alpine: allow /dev/full
5
6The template creates /dev/full for the container but needs also give
7permission to access it.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
11---
12 templates/lxc-alpine.in | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
16index 5fdf36f..8600a34 100644
17--- a/templates/lxc-alpine.in
18+++ b/templates/lxc-alpine.in
19@@ -197,9 +197,10 @@ lxc.cap.drop = sys_module mac_admin mac_override sys_time
20
21 # devices
22 lxc.cgroup.devices.deny = a
23-# /dev/null and zero
24+# /dev/null, zero and full
25 lxc.cgroup.devices.allow = c 1:3 rwm
26 lxc.cgroup.devices.allow = c 1:5 rwm
27+lxc.cgroup.devices.allow = c 1:7 rwm
28 # consoles
29 lxc.cgroup.devices.allow = c 5:1 rwm
30 lxc.cgroup.devices.allow = c 5:0 rwm
31--
321.8.4.1
33
diff --git a/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch b/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch
new file mode 100644
index 0000000000..c971a54101
--- /dev/null
+++ b/main/lxc/0001-lxc-alpine-enable-4-consoles-by-default.patch
@@ -0,0 +1,30 @@
1From 11a944612ca93b8e39f6681c265c70e108f3caf2 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 24 Oct 2013 13:13:28 +0200
4Subject: [PATCH] lxc-alpine: enable 4 consoles by default
5
6We allow 4 consoles in the LXC config file so we can enable 4 in the
7inittab as well.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10---
11 templates/lxc-alpine.in | 3 +++
12 1 file changed, 3 insertions(+)
13
14diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
15index 2756b89..258eed4 100644
16--- a/templates/lxc-alpine.in
17+++ b/templates/lxc-alpine.in
18@@ -103,6 +103,9 @@ configure_alpine() {
19 ::sysinit:/sbin/rc sysinit
20 ::wait:/sbin/rc default
21 tty1:12345:respawn:/sbin/getty 38400 tty1
22+tty2:12345:respawn:/sbin/getty 38400 tty2
23+tty3:12345:respawn:/sbin/getty 38400 tty3
24+tty4:12345:respawn:/sbin/getty 38400 tty4
25 ::ctrlaltdel:/sbin/reboot
26 ::shutdown:/sbin/rc shutdown
27 EOF
28--
291.8.4.1
30
diff --git a/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch b/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch
new file mode 100644
index 0000000000..4d13d01248
--- /dev/null
+++ b/main/lxc/0001-lxc-alpine-enable-loopback-interface-by-default.patch
@@ -0,0 +1,34 @@
1From 3d460a3856376a043b3fa9addee50f89d21fa747 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 16 Oct 2013 14:55:31 +0200
4Subject: [PATCH] lxc-alpine: enable loopback interface by default
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9It was probably disabled by a mistake
10
11Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
12Acked-by: Stéphane Graber <stgraber@ubuntu.com>
13---
14 templates/lxc-alpine.in | 3 +--
15 1 file changed, 1 insertion(+), 2 deletions(-)
16
17diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
18index 05aec74..5fdf36f 100644
19--- a/templates/lxc-alpine.in
20+++ b/templates/lxc-alpine.in
21@@ -110,9 +110,8 @@ EOF
22 grep nameserver /etc/resolv.conf > "$rootfs/etc/resolv.conf"
23
24 # configure the network using the dhcp
25- # note that lxc will set up lo interface
26 cat <<EOF > $rootfs/etc/network/interfaces
27-#auto lo
28+auto lo
29 iface lo inet loopback
30
31 auto eth0
32--
331.8.4.1
34
diff --git a/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch b/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
new file mode 100644
index 0000000000..a24abbb96b
--- /dev/null
+++ b/main/lxc/0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
@@ -0,0 +1,33 @@
1From d19e00ae49f654b90f26f4c7828f74ea1b664343 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu, 24 Oct 2013 08:13:34 +0200
4Subject: [PATCH] lxc-alpine: run bootmisc and syslog at boot runlevel
5
6The bootmisc script is needed to clean up various temp dirs like /tmp
7and migrate /var/run to /run if needed.
8
9The syslog service is started in 'boot' runlevel when running on real
10hardware so we do the same for containers.
11
12Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
13---
14 templates/lxc-alpine.in | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in
18index 8600a34..2756b89 100644
19--- a/templates/lxc-alpine.in
20+++ b/templates/lxc-alpine.in
21@@ -140,7 +140,8 @@ EOF
22 mknod -m 666 "$rootfs/dev/ptmx" c 5 2
23
24 # start services
25- ln -s /etc/init.d/syslog "$rootfs"/etc/runlevels/default/syslog
26+ ln -s /etc/init.d/bootmisc "$rootfs"/etc/runlevels/boot/bootmisc
27+ ln -s /etc/init.d/syslog "$rootfs"/etc/runlevels/boot/syslog
28
29 return 0
30 }
31--
321.8.4.1
33
diff --git a/main/lxc/APKBUILD b/main/lxc/APKBUILD
index 69b2e00ab3..040393f3f2 100644
--- a/main/lxc/APKBUILD
+++ b/main/lxc/APKBUILD
@@ -3,7 +3,7 @@
3pkgname=lxc 3pkgname=lxc
4pkgver=0.9.0 4pkgver=0.9.0
5_mypkgver=${pkgver/_rc/-rc} 5_mypkgver=${pkgver/_rc/-rc}
6pkgrel=3 6pkgrel=4
7pkgdesc="linux containers - tools" 7pkgdesc="linux containers - tools"
8url="http://lxc.sourceforge.net/" 8url="http://lxc.sourceforge.net/"
9arch="all" 9arch="all"
@@ -18,6 +18,13 @@ source="http://linuxcontainers.org/downloads/lxc-$_mypkgver.tar.gz
18 bb-shutdown.patch 18 bb-shutdown.patch
19 alpine-template-backport.patch 19 alpine-template-backport.patch
20 0001-lxc-alpine-create-dev-zero.patch 20 0001-lxc-alpine-create-dev-zero.patch
21
22 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
23 0001-lxc-alpine-allow-dev-full.patch
24 0001-lxc-alpine-enable-4-consoles-by-default.patch
25 0001-lxc-alpine-enable-loopback-interface-by-default.patch
26 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
27
21 lxc.initd 28 lxc.initd
22 " 29 "
23 30
@@ -54,16 +61,31 @@ a0894c2ddf9133c3cc33c264e4596a3c bb-rm.patch
54e96514860ee34b62d1b208ab03c569bc bb-shutdown.patch 61e96514860ee34b62d1b208ab03c569bc bb-shutdown.patch
5525dd200bd158d16a05bb3e7aaef84697 alpine-template-backport.patch 6225dd200bd158d16a05bb3e7aaef84697 alpine-template-backport.patch
56e08b77b3b35adac290b49b9c9e04754c 0001-lxc-alpine-create-dev-zero.patch 63e08b77b3b35adac290b49b9c9e04754c 0001-lxc-alpine-create-dev-zero.patch
574d248c3d47317d7f770963f07fcc1473 lxc.initd" 64c57d7008ab6e7f652159a5f2856a343d 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
65ee3339a1c5d388b65b24bdea924387a8 0001-lxc-alpine-allow-dev-full.patch
66c12ea194274b6c8d3b05bd43ed70c61d 0001-lxc-alpine-enable-4-consoles-by-default.patch
67999a89373f5e2c61d1369526de7e5850 0001-lxc-alpine-enable-loopback-interface-by-default.patch
6875979789ec45ef865895f5ce5721dd3e 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
699f780f761dcaec3ce40d083c6df044d4 lxc.initd"
58sha256sums="1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120 lxc-0.9.0.tar.gz 70sha256sums="1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120 lxc-0.9.0.tar.gz
59c9caea06b87baf5e335821c7e9ce3caca849b33f8176fbd48126c605583e78fc bb-rm.patch 71c9caea06b87baf5e335821c7e9ce3caca849b33f8176fbd48126c605583e78fc bb-rm.patch
600e5706cb077f750afdd6a5a4fd2afdf0b9113126c85e130d92680bed4ce9c20e bb-shutdown.patch 720e5706cb077f750afdd6a5a4fd2afdf0b9113126c85e130d92680bed4ce9c20e bb-shutdown.patch
61df193c4cf08e171c23b0b472750b7b1e0e7a66971c03201a0523e4039909f33b alpine-template-backport.patch 73df193c4cf08e171c23b0b472750b7b1e0e7a66971c03201a0523e4039909f33b alpine-template-backport.patch
628b3b314d99209ae27d78cd4e9469638a945d68d03beefaec499bad373a7cb8cd 0001-lxc-alpine-create-dev-zero.patch 748b3b314d99209ae27d78cd4e9469638a945d68d03beefaec499bad373a7cb8cd 0001-lxc-alpine-create-dev-zero.patch
63ec036b358ead871b03709cc9d3ebecafcc722be19808d4225029b7bd386726dd lxc.initd" 75526ed739247422e0d326d0892612bec520508763203136c620c3c1ee4a9329bf 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
7666c10a207380f5c0f1945ed6f6b1254c554b68127bc3729d7bf335137ab0750d 0001-lxc-alpine-allow-dev-full.patch
77264cbc4efe6983050b3043fb4df031c4d9b93d35eb3c02463bddf530f8701880 0001-lxc-alpine-enable-4-consoles-by-default.patch
78eb5043672ef81cd5b20f25dc847bfad7e9e14b42a794856c3a8c8c1e4e408dfc 0001-lxc-alpine-enable-loopback-interface-by-default.patch
7951bd2fc5f166499c8996d1b89f324168b0c1bbb6b2b79260591d442120098a34 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
808bdb64ecf100b648396456f6765230aab8649665bfcf320baede529ce6c5484d lxc.initd"
64sha512sums="a96133660ca6ea45dc4b8d167267120328577339e933ff9510f03e9d368ca5db77031dc1e7e4529b3e506f63f79c2ce3f8f72571a7dfdbeb2a8799777782a606 lxc-0.9.0.tar.gz 81sha512sums="a96133660ca6ea45dc4b8d167267120328577339e933ff9510f03e9d368ca5db77031dc1e7e4529b3e506f63f79c2ce3f8f72571a7dfdbeb2a8799777782a606 lxc-0.9.0.tar.gz
65b8fe47af6b1341ca472b6337c304f52402c53d400fc1d13895f2f568dd4d81b9ff281efc70bc1ddc221ac457db3bed4a199491059a15f66755deddc93ce91bf1 bb-rm.patch 82b8fe47af6b1341ca472b6337c304f52402c53d400fc1d13895f2f568dd4d81b9ff281efc70bc1ddc221ac457db3bed4a199491059a15f66755deddc93ce91bf1 bb-rm.patch
6686df52e380a01d6d3f588ca395925e8f774529c72e5b4c8dcb701d79fad7697ed8800f0ff51fded2896b2d2af49faa7f26960234fc8c1a6b4bc8f42d85078e6d bb-shutdown.patch 8386df52e380a01d6d3f588ca395925e8f774529c72e5b4c8dcb701d79fad7697ed8800f0ff51fded2896b2d2af49faa7f26960234fc8c1a6b4bc8f42d85078e6d bb-shutdown.patch
67d10e25aeee0aba61a4c3420fe1b2bfd9213e7ef10f399ed5f0ba5d978a97a49fd23044b098f73f6d9651c23b1bb025f30d81deb6aec9edf4d2267afc22a09d60 alpine-template-backport.patch 84d10e25aeee0aba61a4c3420fe1b2bfd9213e7ef10f399ed5f0ba5d978a97a49fd23044b098f73f6d9651c23b1bb025f30d81deb6aec9edf4d2267afc22a09d60 alpine-template-backport.patch
680304aabfac3280cbc18347f1168b2289a98e03b9f6a3134770e43bb914978a64a108a0b0ec709856db161e98366c06c8a65d5a30e730add4cee2968718cdc93a 0001-lxc-alpine-create-dev-zero.patch 850304aabfac3280cbc18347f1168b2289a98e03b9f6a3134770e43bb914978a64a108a0b0ec709856db161e98366c06c8a65d5a30e730add4cee2968718cdc93a 0001-lxc-alpine-create-dev-zero.patch
694712cf4f20c0fb6040a806fc7996f19953e96c56d90c43a1f4af2f9a5be8c7a76b16872fa6dad63d20152795413b73d8492d614f15e20ea3d6760fbbd6855e0f lxc.initd" 8655c2a67eff5c90721de5949b21afc5aa77bf28323616f551beb4404cacfd0ba38cbb7d5046ed54d685414b5fdbbd5b5f20df9cb0c8ee2c0c12e48bd35866e033 0001-lxc-alpine-add-hwaddr-for-a-single-macvlan-interface.patch
87dd686d8ce9cd73807b744163e6b20e41eca17f3ee618cef66f19488cb2527b56d38c04231d25177de6295f2df224cd567add90e257dfa9d6be7f9a50f5c7bf21 0001-lxc-alpine-allow-dev-full.patch
88372490dc5a459778e97b75691ed48b2c070c0a9b16f08c7f5ef3a791ded64fe5f23ca1e145314fea355664a2b055eb572546dd0793560137baae0898184c9e19 0001-lxc-alpine-enable-4-consoles-by-default.patch
8947d31ed9d0cdde58b0ee97b3f179db270534b73fe8c77fe72fdef1483a545e608a533d41e8b4041474493016cd445fe02751663ad0cbc7fc9af241b344454dea 0001-lxc-alpine-enable-loopback-interface-by-default.patch
9075130578c4103586b973c6e9586833acfa89de8021f4dd320385905c4f9d3d1bf7a1e8d3cfe8704a3add00d41d19c30a371bce232a863e9c837a148e9066a0d6 0001-lxc-alpine-run-bootmisc-and-syslog-at-boot-runlevel.patch
91e3aa39c60db6ba73cbe3fcb27170dd83a03a0a175d8a28513f242a81eef5cb0e90b78dc63fc8da5c7160e60bc780111679fd6d0e401a0d6626e574c328c5afb0 lxc.initd"
diff --git a/main/lxc/lxc.initd b/main/lxc/lxc.initd
index 31bfbd44ca..ae844872a5 100644
--- a/main/lxc/lxc.initd
+++ b/main/lxc/lxc.initd
@@ -58,7 +58,7 @@ start() {
58 58
59 rootpath=$(lxc_get_var lxc.rootfs) 59 rootpath=$(lxc_get_var lxc.rootfs)
60 checkpath -d ${pidfile%/*} 60 checkpath -d ${pidfile%/*}
61 ebegin "Starting ${CONTAINER}" 61 ebegin "Starting container ${CONTAINER}"
62 start-stop-daemon --start $command \ 62 start-stop-daemon --start $command \
63 --pidfile $pidfile \ 63 --pidfile $pidfile \
64 --wait 500 \ 64 --wait 500 \
@@ -75,20 +75,20 @@ start() {
75stop() { 75stop() {
76 checkconfig || return 1 76 checkconfig || return 1
77 77
78 ebegin "Shutting down system in ${CONTAINER}" 78 ebegin "Shutting down system in container ${CONTAINER}"
79 start-stop-daemon --stop --pidfile ${pidfile} \ 79 start-stop-daemon --stop --pidfile ${pidfile} \
80 --retry ${POWEROFF_SIGNAL:-SIGUSR2}/${TIMEOUT:-30} \ 80 --retry ${POWEROFF_SIGNAL:-SIGUSR2}/${TIMEOUT:-30} \
81 --progress 81 --progress
82 eend $? 82 eend $?
83 83
84 ebegin "Stopping ${CONTAINER}" 84 ebegin "Stopping containter ${CONTAINER}"
85 lxc-stop -n ${CONTAINER} 85 lxc-stop -n ${CONTAINER}
86 eend $? 86 eend $?
87} 87}
88 88
89reboot() { 89reboot() {
90 checkconfig || return 1 90 checkconfig || return 1
91 ebegin "Sending reboot signal to $CONTAINER" 91 ebegin "Sending reboot signal to container $CONTAINER"
92 start-stop-daemon --signal ${RESTART_SIG:-SIGTERM} \ 92 start-stop-daemon --signal ${RESTART_SIG:-SIGTERM} \
93 --pidfile ${pidfile} 93 --pidfile ${pidfile}
94 eend $? 94 eend $?