summaryrefslogtreecommitdiffstats
path: root/debianpkg/frr.postinst
blob: 32af741c989f5580cd678f1d83b6d4a315242f58 (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
#!/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 ${frruid}:${frrgid} /etc/frr
chown ${frruid}:${frrgid} /etc/frr/*
touch /etc/frr/vtysh.conf
chgrp ${frrvtygid} /etc/frr/vtysh*
chmod 644 /etc/frr/*

ENVIRONMENTFILE=/etc/environment
if ! egrep --quiet '^VTYSH_PAGER=' ${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

#DEBHELPER#