source: trunk/packages/invirt-dev/debian/invirt-dev.postinst @ 1774

Last change on this file since 1774 was 1770, checked in by broder, 16 years ago

Fix invirt-dev to not add the same line a bunch of times to sudoers

  • Property svn:executable set to *
File size: 1008 bytes
RevLine 
[956]1#!/bin/sh
2set -e
3
4#DEBHELPER#
5
6case "$1" in
7    configure)
8        if [ -z "$2" ]; then
9            adduser --system repository
10            addgroup --system repo
[1770]11           
12            # Clean up the old sudoers block, then add it back
13            perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
14           
15            cat >>/etc/sudoers <<EOF
16### BEGIN invirt-dev
17%repo   ALL=(repository)        ALWAYS_SET_HOME,NOPASSWD: /usr/bin/reprepro
18### END invirt-dev
19EOF
[956]20            echo "-----"
[1322]21            echo "invirt-dev: run"
[956]22            echo "  adduser --disabled-password \$user"
23            echo "  adduser \$user repo"
[1329]24            echo "  adduser \$user sbuild"
[956]25            echo "to make individual users that will build packages."
26            echo "-----"
27        fi
28    ;;
29
30    abort-upgrade|abort-remove|abort-deconfigure)
31    ;;
32
33    *)
34        echo "postinst called with unknown argument \`$1'" >&2
35        exit 1
36    ;;
37esac
Note: See TracBrowser for help on using the repository browser.