#!/bin/sh set -e action=$1 version=$2 DEFAULTSFILE="/etc/default/ferm" BACKUPDEFAULTSFILE="${DEFAULTSFILE}.bak" # sha256 hashes of $DEFAULTSFILE in ferm 2.5.1-4,↲ # with ENABLE="yes" and ENABLE="no"↲ DEFAULTSFILEHASHES=" 64c84ccb16e984935c05dec6fa8d6b424b4f83735a9c53430a4ba34c5eb3074d 96affdfb381229de75cacb94412580df3938ad5f1e87ae1d004ab303630cd571 " if [ "${action}" = "upgrade" ]; then # remove old cache files rm -f /var/cache/ferm/*.sh /var/cache/ferm/*.tmp # ferm 2.5.1-4 and earlier managed their defaultsfile in the # maintainer script. Move old defaultsfile away if unchanged if dpkg --compare-versions "${version}" le-nl "2.5.1-4"; then if [ -e "${DEFAULTSFILE}" ]; then CURRENT_HASH="$(sha256sum "${DEFAULTSFILE}" | cut -d ' ' -f 1)" if printf "%s\n" "${DEFAULTSFILEHASHES}" | grep --quiet --line-regexp --fixed-strings "${CURRENT_HASH}"; then if [ -e "${BACKUPDEFAULTSFILE}" ]; then TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") mv "${BACKUPDEFAULTSFILE}" "${BACKUPDEFAULTSFILE}.${TIMESTAMP}" fi mv "${DEFAULTSFILE}" "${DEFAULTSFILE}.bak" fi fi fi fi # Automatically added by dh_installinit/13.25 if [ "$1" = "install" ] && [ -n "$2" ] && [ -e "/etc/init.d/ferm" ] ; then chmod +x "/etc/init.d/ferm" >/dev/null || true fi # End automatically added section