]> git.proxmox.com Git - mirror_frr.git/blame - debian/quagga.preinst
zebra: add hooks upon enabling / disabling a VRF
[mirror_frr.git] / debian / quagga.preinst
CommitLineData
4d916382
DS
1#!/bin/bash
2
3if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
4${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*"}
5set -e
6set -u
7
8# creating quaggavty group if it isn't already there
9if ! getent group quaggavty >/dev/null; then
10 addgroup --system quaggavty >/dev/null
11fi
12
13# creating quagga group if it isn't already there
14if ! getent group quagga >/dev/null; then
15 addgroup --system quagga >/dev/null
16fi
17
18# creating quagga user if he isn't already there
19if ! getent passwd quagga >/dev/null; then
20 adduser \
21 --system \
22 --ingroup quagga \
23 --home /var/run/quagga/ \
24 --gecos "Quagga routing suite" \
25 --shell /bin/false \
26 quagga >/dev/null
27fi
28
29# Do not change permissions when upgrading as it would violate policy.
30if [ "$1" = "install" ]; then
31 # Logfiles are group readable in case users were put into the quagga group.
32 d=/var/log/quagga/
33 mkdir -p $d
34 chown -R quagga:quagga $d
35 chmod u=rwx,go=rx $d
36 find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,g=r,o=
37
38 # Strict permissions for the sockets.
39 d=/var/run/quagga/
40 mkdir -p $d
41 chown -R quagga:quagga $d
42 chmod u=rwx,go=rx $d
43 find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,go=
44
45 # Config files. Vtysh does not have access to the individual daemons config file
46 d=/etc/quagga/
47 mkdir -p $d
48 chown quagga:quaggavty $d
49 chmod ug=rwx,o=rx $d
50 find $d -type f -print0 | xargs -0 --no-run-if-empty chown quagga:quagga
51 find $d -type f -print0 | xargs -0 --no-run-if-empty chmod u=rw,g=r,o=
52
53 # Exceptions for vtysh.
54 f=$d/vtysh.conf
55 if [ -f $f ]; then
56 chown quagga:quaggavty $f
57 chmod u=rw,g=r,o= $f
58 fi
59
60 # Exceptions for vtysh.
61 f=$d/Quagga.conf
62 if [ -f $d/Zebra.conf ]; then
63 mv $d/Zebra.conf $f
64 fi
65 if [ -f $f ]; then
66 chown quagga:quaggavty $f
67 chmod u=rw,g=r,o= $f
68 fi
69fi
70
4d916382 71#DEBHELPER#