# Installation location of SABnzbd SABNZBD_DIR="/opt/sabnzbd" # should not be changed ## arg 1: the new package version post_install() { # add x-nzb mimetype if [[ -f /usr/bin/xdg-mime ]]; then xdg-mime install --mode system "${SABNZBD_DIR}/x-nzb.xml" xdg-icon-resource install --context mimetypes --size 256 "${SABNZBD_DIR}/nzb.png" application-x-nzb fi cat << "EOM" ==> If you want to associate .nzb-files with SABnzbd, run 'xdg-mime default sabnzbd.desktop applications/x-nzb' EOM } ## arg 1: the new package version ## arg 2: the old package version pre_upgrade() { PID="$(pgrep -f SABnzbd.py)" if [ -n "${PID}" ];then systemctl stop sabnzbd.service fi } ## arg 1: the old package version pre_remove() { pre_upgrade if [[ -f /usr/bin/xdg-mime ]]; then xdg-mime uninstall --mode system "${SABNZBD_DIR}/x-nzb.xml" xdg-icon-resource uninstall --context mimetypes --size 256 application-x-nzb fi } ## arg 1: the old package version post_remove() { echo "==> There may be some files left in ${SABNZBD_DIR}." } # vim:set ts=2 sw=2 et: