source: trunk/debathena/debathena/kiosk/debian/debathena-kiosk.postinst @ 25577

Revision 25577, 1.7 KB checked in by jdreed, 12 years ago (diff)
In kiosk: * Make postinst idempotent (Trac: 770)
  • Property svn:executable set to *
Line 
1#!/bin/sh
2# postinst script for debathena-kiosk
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20
21case "$1" in
22    configure)
23        # Add the kiosk user.
24        user=kiosk@mit
25        if ! getent passwd $user >/dev/null; then
26            adduser --system --force-badname $user
27        fi
28        # In the new gdm, the launcher is invoked as user gdm.
29        gdm_version="$(dpkg-query -W -f '${Version}' gdm)"
30        if dpkg --compare-versions "$gdm_version" ge '2.25.2~' &&
31            [ "$(perl -e 'BEGIN { $found=0; } $found = 1 if /^### BEGIN debathena-kiosk/../^### END debathena-kiosk/; END { print $found; }' /etc/sudoers)" = "0" ]; then
32            cat >>/etc/sudoers <<EOF
33### BEGIN debathena-kiosk
34# gdm can launch kiosk mode
35gdm ALL=NOPASSWD: /usr/lib/debathena-kiosk/launch-kiosk
36lightdm ALL=NOPASSWD: /usr/lib/debathena-kiosk/launch-kiosk
37### END debathena-kiosk
38EOF
39        fi
40    ;;
41
42    abort-upgrade|abort-remove|abort-deconfigure)
43    ;;
44
45    *)
46        echo "postinst called with unknown argument \`$1'" >&2
47        exit 1
48    ;;
49esac
50
51# dh_installdeb will replace this with shell code automatically
52# generated by other debhelper scripts.
53
54#DEBHELPER#
55
56exit 0
Note: See TracBrowser for help on using the repository browser.