tags 597239 patch
thanks

Quoting Josselin Mouette (j...@debian.org):
> Package: user-setup
> Severity: normal
> Tags: d-i
> 
> Hi,
> 
> since version 1.7.2-2, sudo ships with a configuration making all users 
> belonging to the "sudo" group administrators.
> It is enough to add the user to this group instead of adding him 
> manually to the sudoers file.
> 
> It will also allow such users to benefit from PolicyKit exceptions in a 
> similar way to sudo , so this is an important change to get in squeeze.


Agreed.

Here's a proposed patch. Maybe a little bit overdesigned as I
tentatively check the version of the sudo package that's installed on
the system before adding the created user to the sudo group, falling
back to old behaviour if sudo has a lower version.

This is untested. I'm not 100% sure that "my" test is correct, so
comments welcomed.


Index: user-setup-apply
===================================================================
--- user-setup-apply    (révision 64763)
+++ user-setup-apply    (copie de travail)
@@ -157,7 +157,13 @@
                        apt-install sudo 2>/dev/null || $log $chroot $ROOT 
apt-get -q -y install sudo || true
                fi
                if [ -e $ROOT/etc/sudoers ]; then
-                       echo "$USER ALL=(ALL) ALL" >> $ROOT/etc/sudoers
+                       # Test if sudo > 1.7.2-2 is installed, with
+                       # all users from group sudo being admins
+                       if $log $chroot dpkg --compare-versions `dpkg-query -W 
-f='${Version}' sudo 2>/dev/null` ge '1.7.2-2'; then
+                               $log $chroot $ROOT adduser "$USER" sudo 
>/dev/null 2>&1 || true
+                       else
+                               echo "$USER ALL=(ALL) ALL" >> $ROOT/etc/sudoers
+                       fi
                else
                        # sudo failed to install, system won't be usable
                        exit 1

Attachment: signature.asc
Description: Digital signature

Reply via email to