frr/debian/frr.postinst

49 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/sh
set -e
# most of this file makes sense to execute regardless of whether this is any
# of normal "configure" or error-handling "abort-upgrade", "abort-remove" or
# "abort-deconfigure"
groupadd --system frrvty
groupadd --system frr
useradd \
--system \
-c "Frr routing suite" \
-g frr \
--home-dir /nonexistent \
--no-create-home \
frr
usermod -a -G frrvty frr
mkdir -m 0755 -p /var/log/frr
mkdir -m 0700 -p /var/lib/frr
mkdir -p /etc/frr
chown frr: /var/lib/frr
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)
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
#DEBHELPER#