]> git.proxmox.com Git - mirror_frr.git/blob - debian/backports/ubuntu12.04/debian/frr.postinst
debian: move ubuntu 12.04 files into new backports system
[mirror_frr.git] / debian / backports / ubuntu12.04 / debian / frr.postinst
1 #!/bin/bash -e
2
3 ######################
4 PASSWDFILE=/etc/passwd
5 GROUPFILE=/etc/group
6
7 frruid=`egrep "^frr:" $PASSWDFILE | awk -F ":" '{ print $3 }'`
8 frrgid=`egrep "^frr:" $GROUPFILE | awk -F ":" '{ print $3 }'`
9 frrvtygid=`egrep "^frrvty:" $GROUPFILE | awk -F ":" '{ print $3 }'`
10
11 [ -n ${frruid} ] || (echo "No uid for frr in ${PASSWDFILE}" && /bin/false)
12 [ -n ${frrgid} ] || (echo "No gid for frr in ${GROUPFILE}" && /bin/false)
13 [ -n ${frrVTYgid} ] || (echo "No gid for frrvty in ${GROUPFILE}" && /bin/false)
14
15 chown -R ${frruid}:${frrgid} /etc/frr
16 touch /etc/frr/vtysh.conf
17 chgrp ${frrvtygid} /etc/frr/vtysh*
18 chmod 440 /etc/sudoers.d/frr_sudoers
19 chmod 644 /etc/frr/*
20
21 ENVIRONMENTFILE=/etc/environment
22 if ! grep --quiet VTYSH_PAGER=/bin/cat ${ENVIRONMENTFILE}; then
23 echo "VTYSH_PAGER=/bin/cat" >> ${ENVIRONMENTFILE}
24 fi
25 ##################################################
26
27 if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
28 ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
29
30 # This is most likely due to the answer "no" to the "really stop the server"
31 # question in the prerm script.
32 if [ "$1" = "abort-upgrade" ]; then
33 exit 0
34 fi
35
36 . /usr/share/debconf/confmodule
37
38 db_stop
39
40 if [ -x "/etc/init.d/frr" ] || [ -e "/etc/init/frr.conf" ]; then
41 if [ ! -e "/etc/init/frr.conf" ]; then
42 update-rc.d frr defaults >/dev/null
43 fi
44 invoke-rc.d frr start || exit $?
45 fi
46
47 #DEBHELPER#
48