blob: a0abc8266b6f42afa8293f8354c84bfabac7a436 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# 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:
|