summaryrefslogtreecommitdiffstats
path: root/debian/frr.postinst
blob: 9020d7bf7a9dac45776acfdbcadeeb2b6ea0e32d (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
#!/bin/bash -e

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

frruid=`egrep "^frr:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
frrgid=`egrep "^frr:" $GROUPFILE | awk -F ":" '{ print $3 }'`
frrvtygid=`egrep "^frrvty:" $GROUPFILE | awk -F ":" '{ print $3 }'`

[ -n ${frruid} ]    || (echo "No uid for frr in ${PASSWDFILE}"   && /bin/false)
[ -n ${frrgid} ]    || (echo "No gid for frr in ${GROUPFILE}"    && /bin/false)
[ -n ${frrVTYgid} ] || (echo "No gid for frrvty in ${GROUPFILE}" && /bin/false)

chown -R ${frruid}:${frrgid} /etc/frr
touch /etc/frr/vtysh.conf
chgrp ${frrvtygid} /etc/frr/vtysh*
chmod 644 /etc/frr/*

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#