From: Stéphane Graber Date: Tue, 31 Jul 2012 14:01:28 +0000 (+0200) Subject: ubuntu template: add sudo group and cleanup minor devttydir issue X-Git-Tag: lxc-0.8.0~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96bd45c823a8b8aaf1d684ccc8ad063ac411a0f4;p=thirdparty%2Flxc.git ubuntu template: add sudo group and cleanup minor devttydir issue Always add the user to the 'sudo' group as it's been around since at least Ubuntu 10.04. In addition make the user part of the admin group until 12.04 where it's been removed. Also fix a minor layout issue with devttydir. Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index f31bc789c..d959ccb49 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -55,9 +55,9 @@ EOF EOF if [ "$release" = "precise" ]; then - group="sudo" + groups="sudo" else - group="admin" + groups="sudo admin" # suppress log level output for udev sed -i "s/=\"err\"/=0/" $rootfs/etc/udev/udev.conf @@ -67,9 +67,14 @@ EOF rm -f $rootfs/etc/init/tty{5,6}.conf fi - chroot $rootfs groupadd --system $group >/dev/null 2>&1 || true - chroot $rootfs useradd --create-home -s /bin/bash -G $group ubuntu + chroot $rootfs useradd --create-home -s /bin/bash ubuntu echo "ubuntu:ubuntu" | chroot $rootfs chpasswd + + for group in $groups; do + chroot $rootfs groupadd --system $group >/dev/null 2>&1 || true + chroot $rootfs adduser ubuntu $group >/dev/null 2>&1 || true + done + if [ -n "$auth_key" -a -f "$auth_key" ]; then u_path="/home/ubuntu/.ssh" root_u_path="$rootfs/$u_path" @@ -307,7 +312,7 @@ EOF cat <> $path/config lxc.utsname = $name -lxc.devttydir = $ttydir +lxc.devttydir =$ttydir lxc.tty = 4 lxc.pts = 1024 lxc.rootfs = $rootfs