]>
Commit | Line | Data |
---|---|---|
4d916382 | 1 | #!/bin/bash |
4d916382 | 2 | set -e |
17479133 DL |
3 | # bash is required since /etc/frr/daemons.conf used a bash array in some |
4 | # previous versions. | |
5 | ||
6 | case "$1" in | |
7 | install|upgrade) | |
8 | ( | |
9 | test -f /etc/frr/daemons && . /etc/frr/daemons | |
10 | test -f /etc/frr/daemons.conf && . /etc/frr/daemons.conf | |
11 | test -f /etc/default/frr && . /etc/default/frr | |
12 | ||
13 | if [ "$watchfrr_enable" = no -o \ | |
14 | "$watchfrr_enable" = "0" ]; then | |
a86f22ce | 15 | cat >&2 <<EOF |
17479133 DL |
16 | ERROR: Pre-existing frr configuration file disables watchfrr. |
17 | ||
18 | This configuration is deprecated upstream and not supported by the Debian | |
19 | FRR package. Refusing to $1 in order to not break running setups. | |
20 | Please change your setup to use watchfrr and remove the "watchfrr_enable" | |
21 | option from /etc/frr/daemons, /etc/frr/daemons.conf and/or /etc/default/frr. | |
22 | EOF | |
23 | exit 1 | |
24 | fi | |
25 | ) | |
a86f22ce DL |
26 | vtysh='' |
27 | if test -f /etc/frr/vtysh.conf; then | |
28 | if grep -q '^[[:space:]]*service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then | |
29 | # existing vtysh.conf with integrated statement | |
30 | # - do nothing (=> integrated config) | |
31 | vtysh='i' | |
32 | elif grep -q '^[[:space:]]*no[[:space:]]\+service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then | |
33 | # explicit non-integrated | |
34 | # => need to fix vtysh.conf & frr.conf in postinst | |
35 | vtysh='ni' | |
36 | if test -f /etc/frr/frr.conf; then | |
37 | cat >&2 <<EOF | |
38 | ERROR: Pre-existing /etc/frr/vtysh.conf specifies | |
39 | "no service integrated-vtysh-config", but /etc/frr/frr.conf exists. This | |
40 | will cause the frr package to malfunction. Please remove /etc/frr/frr.conf | |
41 | or remove the "no service integrated-vtysh-config" statement from | |
42 | /etc/frr/vtysh.conf. | |
43 | EOF | |
44 | exit 1 | |
45 | fi | |
46 | else | |
47 | # vtysh.conf exists but has no statement | |
48 | : | |
49 | fi | |
50 | fi | |
51 | if test -f /etc/frr/frr.conf; then | |
52 | # vtysh.conf has no explicit statement but frr.conf exists | |
53 | # => integrated config used | |
54 | vtysh='i' | |
55 | elif test -f /etc/frr/zebra.conf \ | |
56 | -o -f /etc/frr/bgpd.conf \ | |
57 | -o -f /etc/frr/ospfd.conf \ | |
58 | -o -f /etc/frr/ospf6d.conf \ | |
59 | -o -f /etc/frr/ripd.conf \ | |
60 | -o -f /etc/frr/ripngd.conf \ | |
61 | -o -f /etc/frr/isisd.conf \ | |
62 | -o -f /etc/frr/pimd.conf \ | |
63 | -o -f /etc/frr/ldpd.conf \ | |
64 | -o -f /etc/frr/nhrpd.conf \ | |
65 | -o -f /etc/frr/eigrpd.conf \ | |
66 | -o -f /etc/frr/babeld.conf \ | |
67 | -o -f /etc/frr/pbrd.conf \ | |
68 | -o -f /etc/frr/bfdd.conf; then | |
69 | # no explicit statement, but some split config file exists | |
70 | # => need to fix vtysh.conf & frr.conf in postinst | |
71 | test -n "$vtysh" || vtysh='ni' | |
72 | else | |
73 | # no config at all - use integrated | |
74 | : | |
75 | fi | |
76 | if test "$vtysh" = "ni"; then | |
77 | touch /etc/frr/.pkg.frr.nointegrated | |
78 | fi | |
17479133 DL |
79 | ;; |
80 | abort-upgrade) | |
81 | # shouldn't fail an upgrade abort | |
82 | ;; | |
83 | esac | |
4d916382 | 84 | |
4d916382 | 85 | #DEBHELPER# |