summaryrefslogtreecommitdiffstats
path: root/debian/quagga.postinst
blob: 4611313c1dd587f93fb133a165962f2177f9a03b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash -e

######################
PASSWDFILE=/etc/passwd
GROUPFILE=/etc/group

quaggauid=`egrep "^quagga:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
quaggagid=`egrep "^quagga:" $GROUPFILE | awk -F ":" '{ print $3 }'`
quaggavtygid=`egrep "^quaggavty:" $GROUPFILE | awk -F ":" '{ print $3 }'`

[ -n ${quaggauid} ]    || (echo "No uid for quagga in ${PASSWDFILE}"   && /bin/false)
[ -n ${quaggagid} ]    || (echo "No gid for quagga in ${GROUPFILE}"    && /bin/false)
[ -n ${quaggaVTYgid} ] || (echo "No gid for quaggavty in ${GROUPFILE}" && /bin/false)

chown -R ${quaggauid}:${quaggagid} /etc/quagga
touch /etc/quagga/vtysh.conf
chgrp ${quaggavtygid} /etc/quagga/vtysh*
chmod 440 /etc/sudoers.d/quagga_sudoers
chmod 644 /etc/quagga/*

ENVIRONMENTFILE=/etc/environment
if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
    echo "VTYSH_PAGER=/bin/cat"  >> ${ENVIRONMENTFILE}
fi
##################################################

if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}

# This is most likely due to the answer "no" to the "really stop the server"
# question in the prerm script.
if [ "$1" = "abort-upgrade" ]; then
  exit 0
fi

. /usr/share/debconf/confmodule

db_stop

#DEBHELPER#