summaryrefslogtreecommitdiffstats
path: root/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
blob: 4d21a02daec54ee5bf2442d41eeb7978c12bb6c9 (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
From 9e74f8161b8db05365fde0646b0c29c852afc3a0 Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Date: Tue, 14 May 2013 11:54:23 +0300
Subject: [PATCH] lxc-busybox: check when bind-mounting host libdirs

The patch changes the busybox template behavior to automatically
mount /lib and /usr/lib. In case one of these folders does not exist,
starting the container will fail. Also, if there are other lib entries
on the host - e.g. /usr/lib64 -  mount them as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
---
 templates/lxc-busybox.in | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index cb425ec..49effae 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -240,13 +240,6 @@ lxc.pts = 1
 #lxc.aa_profile = unconfined
 EOF
 
-if [ -d "$rootfs/lib" ]; then
-cat <<EOF >> $path/config
-lxc.mount.entry = /lib $rootfs/lib none ro,bind 0 0
-lxc.mount.entry = /usr/lib $rootfs/usr/lib none ro,bind 0 0
-EOF
-fi
-
     libdirs="\
         lib \
         usr/lib \
@@ -255,6 +248,7 @@ fi
 
     for dir in $libdirs; do
         if [ -d "/$dir" ] && [ -d "$rootfs/$dir" ]; then
+            echo "lxc.mount.entry = /$dir $rootfs/$dir none ro,bind 0 0" >> $path/config
             echo "lxc.mount.entry = /$dir $dir none ro,bind 0 0" >> $path/config
         fi
     done
-- 
1.7.11.7