diff options
-rw-r--r-- | debian/frr.postinst | 18 | ||||
-rw-r--r-- | debian/frr.postrm | 2 | ||||
-rw-r--r-- | debian/frr.preinst | 55 |
3 files changed, 74 insertions, 1 deletions
diff --git a/debian/frr.postinst b/debian/frr.postinst index 9be6f3801..a6dff333a 100644 --- a/debian/frr.postinst +++ b/debian/frr.postinst @@ -64,10 +64,28 @@ the FRR service but its contents should be migrated to /etc/frr/daemons. EOF } +rmsum() { + fname="$1" + test -f "$1" || return 0 + fhash="`sha1sum \"$fname\"`" + fhash="${fhash%% *}" + if test "$fhash" = "$2"; then + rm "$fname" + fi +} + case "$1" in configure) check_old_config /etc/frr/daemons.conf check_old_config /etc/default/frr + if test -f /etc/frr/.pkg.frr.nointegrated; then + # remove integrated config setup + # (if checksums match, the files match freshly installed + # defaults, but the user has split config in place) + rmsum /etc/frr/vtysh.conf 5e7e3a488c51751e1ff98f27c9ad6085e1ad9cbb + rmsum /etc/frr/frr.conf dac6f2af4fca9919ba40eb338885a5d1773195c8 + rm /etc/frr/.pkg.frr.nointegrated + fi ;; esac diff --git a/debian/frr.postrm b/debian/frr.postrm index bbce0daf1..018f59e1c 100644 --- a/debian/frr.postrm +++ b/debian/frr.postrm @@ -1,6 +1,8 @@ #!/bin/sh set -e +rm -f /etc/frr/.pkg.frr.nointegrated + if [ "$1" = "purge" ]; then rm -rf /run/frr || true 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 |