#!/bin/sh set -e before_install() { : } before_upgrade() { : } if [ "${1}" = "install" -a -z "${2}" ] then before_install elif [ "${1}" = "upgrade" -a -n "${2}" ] then upgradeFromVersion="${2}" before_upgrade "${upgradeFromVersion}" elif [ "${1}" = "install" -a -n "${2}" ] then upgradeFromVersion="${2}" # Executed when a package is removed but its config files aren't, # and a new version is installed. # Looks a _lot_ like an upgrade case, I say we just execute the # same "before upgrade" script as in the previous case before_upgrade "${upgradeFromVersion}" elif echo "${1}" | grep -E -q '(fail|abort)' then echo "Failed to install before the pre-installation script was run." >&2 exit 1 fi