diff options
Diffstat (limited to 'recipes-containers/lxc/files/lxc-busybox-support-enea-linux-init.patch')
-rw-r--r-- | recipes-containers/lxc/files/lxc-busybox-support-enea-linux-init.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/recipes-containers/lxc/files/lxc-busybox-support-enea-linux-init.patch b/recipes-containers/lxc/files/lxc-busybox-support-enea-linux-init.patch new file mode 100644 index 0000000..4eecfaa --- /dev/null +++ b/recipes-containers/lxc/files/lxc-busybox-support-enea-linux-init.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | lxc: Modify lxc-busybox to support Enea Linux | ||
2 | |||
3 | In Enea Linux, the busybox commands are split between busybox.nosuid (symlinked | ||
4 | as /bin/busybox) and busybox.suid. This patch enables the commands provided by | ||
5 | the latter and also replaces the busybox init with the SysV counterpart. | ||
6 | |||
7 | Upstream-Status: Pending | ||
8 | |||
9 | Signed-off-by: Petre Pircalabu <petre.pircalabu@enea.com> | ||
10 | |||
11 | --- a/templates/lxc-busybox.in | ||
12 | +++ b/templates/lxc-busybox.in | ||
13 | @@ -129,6 +129,7 @@ EOF | ||
14 | # and propose a shell on the tty, the last one is | ||
15 | # not needed | ||
16 | cat <<EOF >> $rootfs/etc/inittab | ||
17 | +id:5:initdefault: | ||
18 | ::sysinit:/etc/init.d/rcS | ||
19 | tty1::respawn:/bin/getty -L tty1 115200 vt100 | ||
20 | console::askfirst:/bin/sh | ||
21 | @@ -209,8 +210,28 @@ configure_busybox() | ||
22 | xargs -n1 ln -s busybox | ||
23 | popd > /dev/null | ||
24 | |||
25 | - # relink /sbin/init | ||
26 | - ln $rootfs/bin/busybox $rootfs/sbin/init | ||
27 | + which busybox.suid >/dev/null 2>&1 | ||
28 | + | ||
29 | + if [ $? -eq 0 ]; then | ||
30 | + # copy busybox.suid in the rootfs | ||
31 | + cp $(which busybox.suid) $rootfs/bin | ||
32 | + if [ $? -ne 0 ]; then | ||
33 | + echo "failed to copy busybox.suid in the rootfs" | ||
34 | + return 1 | ||
35 | + fi | ||
36 | + | ||
37 | + pushd $rootfs/bin > /dev/null || return 1 | ||
38 | + ./busybox.suid --help | grep 'Currently defined functions:' -A300 | \ | ||
39 | + grep -v 'Currently defined functions:' | tr , '\n' | \ | ||
40 | + xargs -n1 ln -s busybox.suid | ||
41 | + popd > /dev/null | ||
42 | + fi | ||
43 | + | ||
44 | + # use SysV init | ||
45 | + pushd $rootfs/sbin > /dev/null || return 1 | ||
46 | + cp /sbin/init.sysvinit . | ||
47 | + ln -s init.sysvinit init | ||
48 | + popd > /dev/null | ||
49 | |||
50 | # passwd exec must be setuid | ||
51 | chmod +s $rootfs/bin/passwd | ||