]> git.proxmox.com Git - mirror_frr.git/blame - debian/frr.preinst
Merge pull request #5619 from qlyoung/fix-zebra-netlink-undefined-bitshift
[mirror_frr.git] / debian / frr.preinst
CommitLineData
4d916382 1#!/bin/bash
4d916382 2set -e
d29f324a
DL
3# bash is required since /etc/frr/daemons.conf used a bash array in some
4# previous versions.
5
4c3d9ff5
DL
6# NOTE: this code exists specifically to make migrations from Quagga to
7# FRR easier. FRR is able to load most Quagga configurations, but the
8# config handling itself has changed with the move towards the "integrated"
9# /etc/frr/frr.conf approach instead of separate per-daemon config files.
10#
11# That said, with this in place there's a good chance users can use a
12# preexisting Quagga config with little hassle.
13
d29f324a
DL
14case "$1" in
15install|upgrade)
16 (
17 test -f /etc/frr/daemons && . /etc/frr/daemons
18 test -f /etc/frr/daemons.conf && . /etc/frr/daemons.conf
19 test -f /etc/default/frr && . /etc/default/frr
20
21 if [ "$watchfrr_enable" = no -o \
22 "$watchfrr_enable" = "0" ]; then
f673b4f6 23 cat >&2 <<EOF
d29f324a
DL
24ERROR: Pre-existing frr configuration file disables watchfrr.
25
26This configuration is deprecated upstream and not supported by the Debian
27FRR package. Refusing to $1 in order to not break running setups.
28Please change your setup to use watchfrr and remove the "watchfrr_enable"
29option from /etc/frr/daemons, /etc/frr/daemons.conf and/or /etc/default/frr.
30EOF
31 exit 1
32 fi
33 )
f673b4f6
DL
34 vtysh=''
35 if test -f /etc/frr/vtysh.conf; then
36 if grep -q '^[[:space:]]*service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then
37 # existing vtysh.conf with integrated statement
38 # - do nothing (=> integrated config)
39 vtysh='i'
40 elif grep -q '^[[:space:]]*no[[:space:]]\+service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then
41 # explicit non-integrated
42 # => need to fix vtysh.conf & frr.conf in postinst
43 vtysh='ni'
44 if test -f /etc/frr/frr.conf; then
45 cat >&2 <<EOF
46ERROR: Pre-existing /etc/frr/vtysh.conf specifies
47"no service integrated-vtysh-config", but /etc/frr/frr.conf exists. This
48will cause the frr package to malfunction. Please remove /etc/frr/frr.conf
49or remove the "no service integrated-vtysh-config" statement from
50/etc/frr/vtysh.conf.
51EOF
52 exit 1
53 fi
54 else
55 # vtysh.conf exists but has no statement
56 :
57 fi
58 fi
59 if test -f /etc/frr/frr.conf; then
60 # vtysh.conf has no explicit statement but frr.conf exists
61 # => integrated config used
62 vtysh='i'
63 elif test -f /etc/frr/zebra.conf \
64 -o -f /etc/frr/bgpd.conf \
65 -o -f /etc/frr/ospfd.conf \
66 -o -f /etc/frr/ospf6d.conf \
67 -o -f /etc/frr/ripd.conf \
68 -o -f /etc/frr/ripngd.conf \
69 -o -f /etc/frr/isisd.conf \
70 -o -f /etc/frr/pimd.conf \
71 -o -f /etc/frr/ldpd.conf \
72 -o -f /etc/frr/nhrpd.conf \
73 -o -f /etc/frr/eigrpd.conf \
74 -o -f /etc/frr/babeld.conf \
75 -o -f /etc/frr/pbrd.conf \
76 -o -f /etc/frr/bfdd.conf; then
77 # no explicit statement, but some split config file exists
78 # => need to fix vtysh.conf & frr.conf in postinst
79 test -n "$vtysh" || vtysh='ni'
80 else
81 # no config at all - use integrated
82 :
83 fi
84 if test "$vtysh" = "ni"; then
85 touch /etc/frr/.pkg.frr.nointegrated
86 fi
d29f324a
DL
87 ;;
88abort-upgrade)
89 # shouldn't fail an upgrade abort
90 ;;
91esac
4d916382 92
4d916382 93#DEBHELPER#