mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-29 19:38:31 +00:00
fix busybox template
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@fr.ibm.com>
This commit is contained in:
parent
19d618b113
commit
32b37181ea
@ -26,6 +26,7 @@ install_busybox()
|
|||||||
name=$2
|
name=$2
|
||||||
res=0
|
res=0
|
||||||
tree="\
|
tree="\
|
||||||
|
$rootfs/selinux \
|
||||||
$rootfs/dev \
|
$rootfs/dev \
|
||||||
$rootfs/home \
|
$rootfs/home \
|
||||||
$rootfs/root \
|
$rootfs/root \
|
||||||
@ -191,6 +192,13 @@ configure_busybox()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
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
|
# copy busybox in the rootfs
|
||||||
cp $(which busybox) $rootfs/bin
|
cp $(which busybox) $rootfs/bin
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -206,9 +214,10 @@ configure_busybox()
|
|||||||
|
|
||||||
# passwd exec must be setuid
|
# passwd exec must be setuid
|
||||||
chmod +s $rootfs/bin/passwd
|
chmod +s $rootfs/bin/passwd
|
||||||
|
touch $rootfs/etc/shadow
|
||||||
|
chroot $rootfs /bin/passwd -d root
|
||||||
|
|
||||||
echo "root:root" | chroot $rootfs chpasswd
|
echo "No password for 'root', please change !"
|
||||||
echo "Root password is 'root', please change !"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -222,6 +231,7 @@ copy_configuration()
|
|||||||
cat <<EOF >> $path/config
|
cat <<EOF >> $path/config
|
||||||
lxc.utsname = $name
|
lxc.utsname = $name
|
||||||
lxc.tty = 1
|
lxc.tty = 1
|
||||||
|
lxc.pts = 1
|
||||||
lxc.rootfs = $rootfs
|
lxc.rootfs = $rootfs
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user