[lxc-devel] [PATCH 4/4] fix busybox template

Daniel Lezcano dlezcano at fr.ibm.com
Tue Jun 1 16:57:48 UTC 2010


Fix various bug with the busybox template:
 * add a warning when busybox is not statically linked
 * delete the password for root (chpasswd is not available for all busybox)
 * add the new pts option

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
---
 scripts/lxc-busybox.in |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/lxc-busybox.in b/scripts/lxc-busybox.in
index 40542d5..5f04dd8 100644
--- a/scripts/lxc-busybox.in
+++ b/scripts/lxc-busybox.in
@@ -26,6 +26,7 @@ install_busybox()
     name=$2
     res=0
     tree="\
+$rootfs/selinux \
 $rootfs/dev \
 $rootfs/home \
 $rootfs/root \
@@ -191,6 +192,13 @@ configure_busybox()
 	return 1
     fi
 
+    file $(which busybox) | grep -q "statically linked"
+    if [ $? -ne 0 ]; then
+	echo "warning : busybox is not statically linked."
+	echo "warning : The template script may not correctly"
+	echo "warning : setup the container environment."
+    fi
+
     # copy busybox in the rootfs
     cp $(which busybox) $rootfs/bin
     if [ $? -ne 0 ]; then
@@ -206,9 +214,10 @@ configure_busybox()
 
     # passwd exec must be setuid
     chmod +s $rootfs/bin/passwd
+    touch $rootfs/etc/shadow
+    chroot $rootfs /bin/passwd -d root
 
-    echo "root:root" | chroot $rootfs chpasswd
-    echo "Root password is 'root', please change !"
+    echo "No password for 'root', please change !"
 
     return 0
 }
@@ -222,6 +231,7 @@ copy_configuration()
 cat <<EOF >> $path/config
 lxc.utsname = $name
 lxc.tty = 1
+lxc.pts = 1
 lxc.rootfs = $rootfs
 EOF
 
-- 
1.7.0.4





More information about the lxc-devel mailing list