Debian Codegraph @

debian/asterisk-config.postinst

raw
1 #! /bin/sh
2
3 set -e
4
5 # summary of how this script can be called:
6 # * <postinst> `configure' <most-recently-configured-version>
7 # * <old-postinst> `abort-upgrade' <new version>
8 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
9 # <new-version>
10 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
11 # <failed-install-package> <version> `removing'
12 # <conflicting-package> <version>
13
14 case "$1" in
15 configure)
16 set +e # ignore errors temporarily
17
18 # find conffiles under /etc/asterisk belonging to asterisk-config
19 # and chown them to user asterisk.
20 dpkg-query -W -f='${Conffiles}\n' asterisk-config 2>/dev/null | \
21 sed -nr -e 's; (/etc/asterisk/.*) [0-9a-f]*;\1;p' | \
22 while read conffile; do
23 chown asterisk: ${conffile} 2>/dev/null
24 done
25
26 # handle them in the end with a glob since it's way faster
27 dpkg-statoverride --quiet --list '/etc/asterisk/*' | while read STAT; do
28 chown `echo $STAT | cut -d' ' -f 1,2,4 | sed 's/ /:/'` \
29 2>/dev/null
30 done
31
32 set -e
33 ;;
34
35 abort-upgrade|abort-remove|abort-deconfigure)
36 ;;
37
38 *)
39 echo "postinst called with unknown argument \`$1'" >&2
40 exit 1
41 ;;
42 esac
43
44 # dh_installdeb will replace this with shell code automatically
45 # generated by other debhelper scripts.
46
47 #DEBHELPER#
48
49 exit 0
50
51