← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lamont/launchpad/lp-buildd-78 into lp:launchpad

 

LaMont Jones has proposed merging lp:~lamont/launchpad/lp-buildd-78 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lamont/launchpad/lp-buildd-78/+merge/56700

As released.  Sadly, there is still a little bit more to be done before we can really close 742881 for real.  the current situation in production is stable, but only because the ppa builders get sudo 1.6.9 still.
-- 
https://code.launchpad.net/~lamont/launchpad/lp-buildd-78/+merge/56700
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lamont/launchpad/lp-buildd-78 into lp:launchpad.
=== modified file 'lib/canonical/buildd/debian/changelog'
--- lib/canonical/buildd/debian/changelog	2011-04-06 19:35:16 +0000
+++ lib/canonical/buildd/debian/changelog	2011-04-07 06:26:57 +0000
@@ -1,3 +1,9 @@
+launchpad-buildd (78~0) hardy-cat; urgency=low
+
+  * Correctly update sudoers files when needed.  LP: #742881
+
+ -- LaMont Jones <lamont@xxxxxxxxxxxxx>  Wed, 06 Apr 2011 22:20:17 -0600
+
 launchpad-buildd (77) hardy-cat; urgency=low
 
   * Add back in ultimate-backstop umask() correction.

=== modified file 'lib/canonical/buildd/debian/postinst'
--- lib/canonical/buildd/debian/postinst	2009-12-16 00:16:24 +0000
+++ lib/canonical/buildd/debian/postinst	2011-04-07 06:26:57 +0000
@@ -28,8 +28,24 @@
         adduser --ingroup buildd --disabled-login --gecos 'Buildd user' \
                 --uid $BUILDDUID ${USER}
 
-        grep -q ^${USER} /etc/sudoers ||
-                echo "${USER}  ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
+	SUDO_VERSION=$(sudo -V | sed -n '/^Sudo version/s/.* //p')
+	if dpkg --compare-versions $SUDO_VERSION lt 1.7 ||
+	   ! grep -q '^#includedir /etc/sudoers.d' /etc/sudoers; then
+		grep -q ^${USER} /etc/sudoers ||
+		    echo "${USER}  ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
+	else
+		if ! sudo -l -U ${USER} | grep -q '(ALL) NOPASSWD: ALL' ||
+		   ! sudo -l -U ${USER} | grep -q umask_override; then
+		    cat << EOF >> /etc/sudoers.d/buildd
+Defaults:buildd umask_override
+Defaults>buildd umask_override
+
+${USER}  ALL=(ALL) NOPASSWD: ALL
+%buildd ALL=(buildd) NOPASSWD: ALL, (root) NOPASSWD: /bin/su - buildd
+%lpbuildd ALL=(ALL) NOPASSWD: ALL
+EOF
+		fi
+	fi
 
         install -d -o${USER} -m0755 /home/${USER}