Normalisation de mes numéros de version
[asterisk-config-auf-connexions.git] / debian / postinst
CommitLineData
0afa8158
TN
1#! /bin/bash
2# postinst script for asterisk-config-auf-connexions
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# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
14# <failed-install-package> <version> `removing'
15# <conflicting-package> <version>
16# for details, see http://www.debian.org/doc/debian-policy/ or
17# the debian-policy package
18#
19
20
21case "$1" in
22 configure)
23
24 # extrait du postinst general a tous les paquets asterisk...
25
26 # add asterisk user and add it to dialout and audio groups
27 if ! getent passwd asterisk > /dev/null ; then
28 echo 'Adding system user and group for Asterisk' 1>&2
29 adduser --system --group --quiet \
30 --home /var/lib/asterisk \
31 --no-create-home --disabled-login \
32 --gecos "Asterisk PBX daemon" \
33 asterisk
34
35 for group in dialout audio; do
36 if groups asterisk | grep -w -q -v $group; then
37 adduser asterisk $group
38 fi
39 done
40 fi
41
42 # préparation du répertoire pour les config spécifiques à l'AUF
43 test -d /etc/asterisk/auf || mkdir -p /etc/asterisk/auf
44
45 # on (re)force les droits minimum sur /etc/asterisk
46 chown -R root:asterisk /etc/asterisk
47 chmod 0755 /etc/asterisk
48 chmod 0755 /etc/asterisk/auf
49 chmod 0640 /etc/asterisk/*.conf 2> /dev/null || true
50 #chmod 0640 /etc/asterisk/auf/* 2> /dev/null || true
51
49bb45c5 52 # droits minimums sur les clés dans /usr/share
0afa8158
TN
53 chown -R root:asterisk /usr/share/asterisk/keys
54 chmod 0755 /usr/share/asterisk/keys
55 chmod 0444 /usr/share/asterisk/keys/*.pub 2> /dev/null || true
56 chmod 0440 /usr/share/asterisk/keys/*.key 2> /dev/null || true
57
58 # on ne reload que ce qui a été changé par ce paquet : iax et extensions
59 if [ -x /usr/sbin/rasterisk ]; then
c09fec8f 60 rasterisk -x "iax2 reload" || true
44700d89 61 rasterisk -x "dialplan reload" || true
0afa8158
TN
62 fi
63
64 ;;
65
66 abort-upgrade|abort-remove|abort-deconfigure)
67
68 ;;
69
70 *)
71 echo "postinst called with unknown argument \`$1'" >&2
72 exit 1
73 ;;
74esac
75
76# dh_installdeb will replace this with shell code automatically
77# generated by other debhelper scripts.
78
79#DEBHELPER#
80
81exit 0