blob: 9be6f38018c1b85a5e3c1e69bea6a57b3085ce58 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  | 
#!/bin/sh
set -e
# most of this file makes sense to execute regardless of whether this is any
# of normal "configure" or error-handling "abort-upgrade", "abort-remove" or
# "abort-deconfigure"
addgroup --system frrvty
addgroup --system frr
adduser \
	--system \
	--ingroup frr \
	--home /nonexistent \
	--gecos "Frr routing suite" \
	frr
usermod -a -G frrvty frr
mkdir -p /var/log/frr
mkdir -p /etc/frr
# only change ownership of files when they were previously owned by root or
# quagga; this is to ensure we don't trample over some custom user setup.
#
# if we are on a freshly installed package (or we added new configfiles),
# the files should be owned by root by default so we should end up with "frr"
# owned configfiles.
quaggauid=`id -u quagga 2>/dev/null || echo 0`
quaggagid=`id -g quagga 2>/dev/null || echo 0`
find \
	/etc/frr \
	/var/log/frr \
		\( -uid 0 -o -uid $quaggauid \) -a \
		\( -gid 0 -o -gid $quaggauid \) | \
	while read filename; do
	# don't chown anything that has ACLs (but don't fail if we don't
	# have getfacl)
	if { getfacl -c "$filename" 2>/dev/null || true; } \
		| egrep -q -v '^((user|group|other)::|$)'; then
		:
	else
		chown frr: "$filename"
		chmod o-rwx "$filename"
	fi
done
# fix misconfigured vtysh.conf & frr.conf ownership set up by some inofficial
# ("pre"-Debian) packages
find /etc/frr -maxdepth 1 \( -name vtysh.conf -o -name frr.conf \) \
	-group frrvty -exec chgrp frr {} \;
check_old_config() {
	oldcfg="$1"
	[ -r "$oldcfg" ] || return 0
	[ -s "$oldcfg" ] || return 0
	grep -v '^[[:blank:]]*\(#\|$\)' "$oldcfg" > /dev/null || return 0
	cat >&2 <<EOF
Note: deprecated $oldcfg is present. This file is still read by
the FRR service but its contents should be migrated to /etc/frr/daemons.
EOF
}
case "$1" in
configure)
	check_old_config /etc/frr/daemons.conf
	check_old_config /etc/default/frr
	;;
esac
#DEBHELPER#
  |