summaryrefslogtreecommitdiffstats
path: root/debian/frr.preinst
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-12-14 22:43:39 +0100
committerDavid Lamparter <equinox@diac24.net>2019-02-19 21:34:06 +0100
commitf673b4f640315c19f73cc4147ce051a59e9504ff (patch)
treeb9589a0262d9d90e2d53be2faae4c1688a6cab26 /debian/frr.preinst
parentdebian: chop down & rework maintainer scripts (diff)
downloadfrr-f673b4f640315c19f73cc4147ce051a59e9504ff.tar.xz
frr-f673b4f640315c19f73cc4147ce051a59e9504ff.zip
debian: keep working nicely with split config
Drop our configs that say integrated config when there is some pre-existing split config. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'debian/frr.preinst')
-rw-r--r--debian/frr.preinst55
1 files changed, 54 insertions, 1 deletions
diff --git a/debian/frr.preinst b/debian/frr.preinst
index 56ebc707c..fe087c6a7 100644
--- a/debian/frr.preinst
+++ b/debian/frr.preinst
@@ -12,7 +12,7 @@ install|upgrade)
if [ "$watchfrr_enable" = no -o \
"$watchfrr_enable" = "0" ]; then
- echo >&2 <<EOF
+ cat >&2 <<EOF
ERROR: Pre-existing frr configuration file disables watchfrr.
This configuration is deprecated upstream and not supported by the Debian
@@ -23,6 +23,59 @@ EOF
exit 1
fi
)
+ vtysh=''
+ if test -f /etc/frr/vtysh.conf; then
+ if grep -q '^[[:space:]]*service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then
+ # existing vtysh.conf with integrated statement
+ # - do nothing (=> integrated config)
+ vtysh='i'
+ elif grep -q '^[[:space:]]*no[[:space:]]\+service[[:space:]]\+integrated-vtysh-config' /etc/frr/vtysh.conf; then
+ # explicit non-integrated
+ # => need to fix vtysh.conf & frr.conf in postinst
+ vtysh='ni'
+ if test -f /etc/frr/frr.conf; then
+ cat >&2 <<EOF
+ERROR: Pre-existing /etc/frr/vtysh.conf specifies
+"no service integrated-vtysh-config", but /etc/frr/frr.conf exists. This
+will cause the frr package to malfunction. Please remove /etc/frr/frr.conf
+or remove the "no service integrated-vtysh-config" statement from
+/etc/frr/vtysh.conf.
+EOF
+ exit 1
+ fi
+ else
+ # vtysh.conf exists but has no statement
+ :
+ fi
+ fi
+ if test -f /etc/frr/frr.conf; then
+ # vtysh.conf has no explicit statement but frr.conf exists
+ # => integrated config used
+ vtysh='i'
+ elif test -f /etc/frr/zebra.conf \
+ -o -f /etc/frr/bgpd.conf \
+ -o -f /etc/frr/ospfd.conf \
+ -o -f /etc/frr/ospf6d.conf \
+ -o -f /etc/frr/ripd.conf \
+ -o -f /etc/frr/ripngd.conf \
+ -o -f /etc/frr/isisd.conf \
+ -o -f /etc/frr/pimd.conf \
+ -o -f /etc/frr/ldpd.conf \
+ -o -f /etc/frr/nhrpd.conf \
+ -o -f /etc/frr/eigrpd.conf \
+ -o -f /etc/frr/babeld.conf \
+ -o -f /etc/frr/pbrd.conf \
+ -o -f /etc/frr/bfdd.conf; then
+ # no explicit statement, but some split config file exists
+ # => need to fix vtysh.conf & frr.conf in postinst
+ test -n "$vtysh" || vtysh='ni'
+ else
+ # no config at all - use integrated
+ :
+ fi
+ if test "$vtysh" = "ni"; then
+ touch /etc/frr/.pkg.frr.nointegrated
+ fi
;;
abort-upgrade)
# shouldn't fail an upgrade abort