1 ## arg 1: the new package version
6 xdg-mime install --mode system "${SABNZBD_DIR}/x-nzb.xml"
7 xdg-icon-resource install --context mimetypes --size 64 "${SABNZBD_DIR}/nzb-2.png" application-x-nzb
12 ==> Don't forget to edit /etc/conf.d/sabnzbd!
13 ==> Add your Session key and if necessary your username and password to ensure a proper shutdown.
14 ==> If you want to associate .nzb-files with SABnzbd, run 'xdg-mime default sabnzbd.desktop applications/x-nzb'
18 ## arg 1: the new package version
19 ## arg 2: the old package version
21 PID="$(pgrep -f SABnzbd.py)"
22 if [ -f /run/daemons/sabnzbd ]; then
23 /etc/rc.d/sabnzbd stop # kill the daemon
25 if [ -n "${PID}" ];then
26 kill "${PID}" # kill the daemon finaly
29 #remove with 0.7.x release {{{
30 grep -q "SABNZBD_GROUP" /etc/conf.d/sabnzbd || \
31 echo 'SABNZBD_GROUP="sabnzbd"' >> /etc/conf.d/sabnzbd
32 grep -q "SABNZBD_DIR" /etc/conf.d/sabnzbd || \
33 echo 'SABNZBD_DIR="/opt/sabnzbd"' >> /etc/conf.d/sabnzbd
37 ## arg 1: the new package version
38 ## arg 2: the old package version
42 if [ "${USE_SYSTEM_IDS}" == "1" ]; then
43 if grep -q "^sabnzbd:" /etc/group &> /dev/null; then
44 if grep -q "^SABNZBD_GID=" /etc/conf.d/sabnzbd &> /dev/null; then
45 groupmod -g "${SABNZBD_GID}" -n sabnzbd sabnzbd &> /dev/null
47 groupmod -r -n sabnzbd sabnzbd &> /dev/null
50 if grep -q "^SABNZBD_GID=" /etc/conf.d/sabnzbd &> /dev/null; then
51 groupadd -g "${SABNZBD_GID}" sabnzbd &> /dev/null
53 groupadd -r sabnzbd &> /dev/null
57 if grep -q "^SABNZBD_AGROUP=" /etc/conf.d/sabnzbd &> /dev/null; then
58 SABNZBD_GS="-G ${SABNZBD_AGROUP}"
63 if grep -q "^sabnzbd:" /etc/passwd 2> /dev/null; then
64 if grep -q "^SABNZBD_UID=" /etc/conf.d/sabnzbd &> /dev/null; then
65 usermod -s /sbin/nologin -c "SABnzbd user" -d "${SABNZBD_DIR}" \
66 -u "${SABNZBD_UID}" -g sabnzbd ${SABNZBD_GS} sabnzbd &> /dev/null
68 usermod -s /sbin/nologin -c "SABnzbd user" -d "${SABNZBD_DIR}" \
69 -g sabnzbd ${SABNZBD_GS} -r sabnzbd &> /dev/null
72 if grep -q "^SABNZBD_UID=" /etc/conf.d/sabnzbd &> /dev/null; then
73 useradd -s /sbin/nologin -c "SABnzbd user" -d "${SABNZBD_DIR}" \
74 -u ${SABNZBD_UID} -g sabnzbd "${SABNZBD_GS}" -r sabnzbd &> /dev/null
76 useradd -s /sbin/nologin -c "SABnzbd user" -d "${SABNZBD_DIR}" \
77 -g sabnzbd ${SABNZBD_GS} -r sabnzbd &> /dev/null
82 chown -R "${SABNZBD_USER}:${SABNZBD_GROUP}" "${SABNZBD_DIR}"
85 ## arg 1: the old package version
91 xdg-mime uninstall --mode system "${SABNZBD_DIR}/x-nzb.xml"
92 xdg-icon-resource uninstall --context mimetypes --size 64 application-x-nzb
95 ## arg 1: the old package version
97 userdel sabnzbd &> /dev/null
98 groupdel sabnzbd &> /dev/null || /bin/true
99 echo "==> There may be some files left in /opt/sabnzbd."
102 # vim:set ts=2 sw=2 et: