summaryrefslogtreecommitdiffstats
path: root/debian/frr.preinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:53:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:53:32 +0000
commit25b1166673c7fde5edb4dfa218005bf1a83eb25c (patch)
tree0eb5dc2c4eedabf82b7b531bbe0e5fcb75084e3e /debian/frr.preinst
parentAdding upstream version 8.4.4. (diff)
downloadfrr-25b1166673c7fde5edb4dfa218005bf1a83eb25c.tar.xz
frr-25b1166673c7fde5edb4dfa218005bf1a83eb25c.zip
Adding debian version 8.4.4-1.1~deb12u1.debian/8.4.4-1.1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/frr.preinst')
-rw-r--r--debian/frr.preinst94
1 files changed, 94 insertions, 0 deletions
diff --git a/debian/frr.preinst b/debian/frr.preinst
new file mode 100644
index 0000000..2af5a4e
--- /dev/null
+++ b/debian/frr.preinst
@@ -0,0 +1,94 @@
+#!/bin/bash
+set -e
+# bash is required since /etc/frr/daemons.conf used a bash array in some
+# previous versions.
+
+# NOTE: this code exists specifically to make migrations from Quagga to
+# FRR easier. FRR is able to load most Quagga configurations, but the
+# config handling itself has changed with the move towards the "integrated"
+# /etc/frr/frr.conf approach instead of separate per-daemon config files.
+#
+# That said, with this in place there's a good chance users can use a
+# preexisting Quagga config with little hassle.
+
+case "$1" in
+install|upgrade)
+ (
+ test -f /etc/frr/daemons && . /etc/frr/daemons
+ test -f /etc/frr/daemons.conf && . /etc/frr/daemons.conf
+ test -f /etc/default/frr && . /etc/default/frr
+
+ if [ "$watchfrr_enable" = no -o \
+ "$watchfrr_enable" = "0" ]; then
+ cat >&2 <<EOF
+ERROR: Pre-existing frr configuration file disables watchfrr.
+
+This configuration is deprecated upstream and not supported by the Debian
+FRR package. Refusing to $1 in order to not break running setups.
+Please change your setup to use watchfrr and remove the "watchfrr_enable"
+option from /etc/frr/daemons, /etc/frr/daemons.conf and/or /etc/default/frr.
+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/pathd.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
+ ;;
+esac
+
+#DEBHELPER#