]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ubuntu template: add sudo group and cleanup minor devttydir issue
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 31 Jul 2012 14:01:28 +0000 (16:01 +0200)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Tue, 31 Jul 2012 14:01:28 +0000 (16:01 +0200)
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 <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
templates/lxc-ubuntu.in

index f31bc789c55a67b856cb1f9292737b61d652e7c5..d959ccb49e9167990014a27a3d96649fc7306152 100644 (file)
@@ -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 <<EOF >> $path/config
 lxc.utsname = $name
 
-lxc.devttydir = $ttydir
+lxc.devttydir =$ttydir
 lxc.tty = 4
 lxc.pts = 1024
 lxc.rootfs = $rootfs