2018-08-08 05:18:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2018-12-09 21:41:49 +00:00
|
|
|
NAME=jellyfin
|
2018-08-08 05:18:59 +00:00
|
|
|
CONF_FILE=/etc/${NAME}.conf
|
|
|
|
DEFAULT_FILE=/etc/default/${NAME}
|
|
|
|
|
2018-12-09 21:41:49 +00:00
|
|
|
# Source Jellyfin default configuration
|
2018-08-08 05:18:59 +00:00
|
|
|
if [[ -f $DEFAULT_FILE ]]; then
|
|
|
|
. $DEFAULT_FILE
|
|
|
|
fi
|
|
|
|
|
2018-12-09 21:41:49 +00:00
|
|
|
# Source Jellyfin user configuration overrides
|
2018-08-08 05:18:59 +00:00
|
|
|
if [[ -f $CONF_FILE ]]; then
|
|
|
|
. $CONF_FILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Data directory where Emby database, cache and logs are stored
|
2018-12-09 21:41:49 +00:00
|
|
|
PROGRAMDATA=${JELLYFIN_DATA-/var/lib/$NAME}
|
2018-08-08 05:18:59 +00:00
|
|
|
|
|
|
|
# In case this system is running systemd, we make systemd reload the unit files
|
|
|
|
# to pick up changes.
|
|
|
|
if [[ -d /run/systemd/system ]] ; then
|
|
|
|
systemctl --system daemon-reload >/dev/null || true
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
purge)
|
|
|
|
echo PURGE | debconf-communicate $NAME > /dev/null 2>&1 || true
|
|
|
|
|
2018-12-09 21:41:49 +00:00
|
|
|
if [[ -x "/etc/init.d/jellyfin" ]] || [[ -e "/etc/init/jellyfin.connf" ]]; then
|
|
|
|
update-rc.d jellyfin remove >/dev/null 2>&1 || true
|
2018-08-08 05:18:59 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
|
2018-12-09 21:41:49 +00:00
|
|
|
deb-systemd-helper purge jellyfin.service >/dev/null
|
|
|
|
deb-systemd-helper unmask jellyfin.service >/dev/null
|
2018-08-08 05:18:59 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-09 21:41:49 +00:00
|
|
|
userdel jellyfin > /dev/null 2>&1 || true
|
|
|
|
delgroup --quiet jellyfin > /dev/null 2>&1 || true
|
2018-08-08 05:18:59 +00:00
|
|
|
if [[ -d $PROGRAMDATA ]]; then
|
|
|
|
rm -rf $PROGRAMDATA
|
|
|
|
fi
|
2018-12-09 21:41:49 +00:00
|
|
|
[[ -f /usr/bin/jellyfin ]] && rm /usr/bin/jellyfin
|
|
|
|
[[ -f /etc/sudoers.d/jellyfin-sudoers ]] && rm /etc/sudoers.d/jellyfin-sudoers
|
|
|
|
[[ -d /var/lib/jellyfin ]] && rm -rf /var/lib/jellyfin
|
2018-08-08 05:18:59 +00:00
|
|
|
;;
|
|
|
|
remove)
|
|
|
|
if [[ -x "/usr/bin/deb-systemd-helper" ]]; then
|
2018-12-09 21:41:49 +00:00
|
|
|
deb-systemd-helper mask jellyfin.service >/dev/null
|
2018-08-08 05:18:59 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "postrm called with unknown argument \`$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#DEBHELPER#
|
|
|
|
|
|
|
|
exit 0
|