From 6bc424b5c7c8130ffdb6390eae53b32370a755f8 Mon Sep 17 00:00:00 2001 From: Stuart Yoder Date: Wed, 12 Sep 2012 13:15:12 -0500 Subject: [PATCH] busybox: for all lib dirs create mounts only if directories exist Signed-off-by: Stuart Yoder --- templates/lxc-busybox.in | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index 2cdc3d170..3cab7e7e2 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in @@ -238,24 +238,17 @@ lxc.rootfs = $rootfs #lxc.aa_profile = unconfined EOF -if [ -d "$rootfs/lib" ]; then -cat <> $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 \ + /lib64 \ + /usr/lib64" -if [ -d "/lib64" ] && [ -d "$rootfs/lib64" ]; then -cat <> $path/config -lxc.mount.entry=/lib64 $rootfs/lib64 none ro,bind 0 0 -EOF -fi - -if [ -d "/usr/lib64" ] && [ -d "$rootfs/usr/lib64" ]; then -cat <> $path/config -lxc.mount.entry=/usr/lib64 $rootfs/usr/lib64 none ro,bind 0 0 -EOF -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 + fi + done } usage()