[26470] in Source-Commits

home help back first fref pref prev next nref lref last post

Re: /svn/athena r25577 - trunk/debathena/debathena/kiosk/debian

daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Thu Jun 14 02:04:24 2012

Date: Thu, 14 Jun 2012 02:04:21 -0400 (EDT)
From: Benjamin Kaduk <kaduk@MIT.EDU>
To: Jonathan D Reed <jdreed@MIT.EDU>
cc: source-commits@MIT.EDU
In-Reply-To: <201206062050.q56KoRJJ031592@drugstore.mit.edu>
Message-ID: <alpine.GSO.1.10.1206140203000.18441@multics.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Wed, 6 Jun 2012, Jonathan D Reed wrote:

> Author: jdreed
> Date: 2012-06-06 16:50:27 -0400 (Wed, 06 Jun 2012)
> New Revision: 25577
>
> Modified:
>   trunk/debathena/debathena/kiosk/debian/changelog
>   trunk/debathena/debathena/kiosk/debian/debathena-kiosk.postinst
> Log:
> In kiosk:
>  * Make postinst idempotent (Trac: 770)
>
>
> Modified: trunk/debathena/debathena/kiosk/debian/debathena-kiosk.postinst
> ===================================================================
> --- trunk/debathena/debathena/kiosk/debian/debathena-kiosk.postinst	2012-06-05 21:03:48 UTC (rev 25576)
> +++ trunk/debathena/debathena/kiosk/debian/debathena-kiosk.postinst	2012-06-06 20:50:27 UTC (rev 25577)
> @@ -27,7 +27,8 @@
>         fi
>         # In the new gdm, the launcher is invoked as user gdm.
>         gdm_version="$(dpkg-query -W -f '${Version}' gdm)"
> -        if dpkg --compare-versions "$gdm_version" ge '2.25.2~'; then
> +        if dpkg --compare-versions "$gdm_version" ge '2.25.2~' &&
> +	    [ "$(perl -e 'BEGIN { $found=0; } $found = 1 if /^### BEGIN debathena-kiosk/../^### END debathena-kiosk/; END { print $found; }' /etc/sudoers)" = "0" ]; then

Being idempotent is good.  But this ... is a pretty ugly one-liner.
Can't perl return/exit a value instead of printing it?

In any case, this code does appear to do the desired thing, so I can ACK 
it...

-Ben

home help back first fref pref prev next nref lref last post