summaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc/files/template-make-busybox-template-compatible-with-core-.patch
blob: e4bb72a046db32757652dc484606bf644c15717b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 3a7112a38d2c44b6fa49e0da1dc4765defd88dbb Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselstine@windriver.com>
Date: Thu, 31 May 2018 11:44:44 -0400
Subject: [PATCH] template: make busybox template compatible with

 core-image-minimal

The busybox template makes a lot of assumptions about how the busybox
binary found on the host was configured. Building core-image-minimal
"out of the box" does not configure busybox's 'passwd' or 'init'
applets so we need to work around this.

Chances are if you attempt to use the busybox template with a host
which is note core-image-minimal it will fail but we are making these
changes here to at least have the template work with
core-image-minimal to be able to demonstrate that it can work as well
as to have it available for the ptests.

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>

---
 templates/lxc-busybox.in | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index 9637a71..45b386f 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -181,6 +181,19 @@ configure_busybox()
     return 1
   fi
 
+  # copy host passwd
+  if ! cp "$(which passwd)" "${rootfs}/bin"; then
+      echo "ERROR: Failed to copy passwd binary"
+      return 1
+  fi
+
+  # copy bash binary as the container init
+  if ! cp "$(which bash)" "${rootfs}/sbin/init"; then
+      echo "ERROR: Failed to copy bash binary"
+      return 1
+  fi
+
+
   # symlink busybox for the commands it supports
   # it would be nice to just use "chroot $rootfs busybox --install -s /bin"
   # but that only works right in a chroot with busybox >= 1.19.0
@@ -189,9 +202,6 @@ configure_busybox()
     ./busybox --list | grep -v busybox | xargs -n1 ln -s busybox
   )
 
-  # relink /sbin/init
-  ln "${rootfs}/bin/busybox" "${rootfs}/sbin/init"
-
   # /etc/fstab must exist for "mount -a"
   touch "${rootfs}/etc/fstab"