Improve uninstall()

This commit is contained in:
2021-11-24 15:14:12 -05:00
parent 292a5c5472
commit f9cf7639ba

View File

@@ -1150,18 +1150,21 @@ uninstall() {
exit 0 exit 0
fi fi
# Uninstall services
echo "Stopping and removing all associated Media Center services" echo "Stopping and removing all associated Media Center services"
for _service in $(compgen -A "function" "service"); do for _service in $(compgen -A "function" "service"); do
_service="${_service##service_}"
echo "$_service"
setServiceVars "$_service" setServiceVars "$_service"
if systemctl is-active -q "$_timer_name" || systemctl is-enabled -q "$_timer_name"; then for unit in "$_service."{service,timer}; do
systemctl_disable "$_timer_name" if systemctl is-active -q "$unit" || systemctl is-enabled -q "$unit"; then
fi debug "Disabling $unit"
if systemctl is-active -q "$_service_name" || systemctl is-enabled -q "$_service_name"; then systemctl_disable "$unit"
systemctl_disable "$_service_name" fi
fi done
[[ -f "$_service_fname" ]] && rm_cmd "$_service_fname" for f in "$_service_fname" "$_timer_fname"; do
[[ -f "$_timer_fname" ]] && rm_cmd "$_timer_fname" debug "Removing $f"
rm_cmd "$f"
done
systemctl_reload systemctl_reload
done done
@@ -1182,7 +1185,7 @@ uninstall() {
&& rm_cmd /etc/ufw/applications.d/jriver && rm_cmd /etc/ufw/applications.d/jriver
fi fi
echo "Uninstalling Media Center" echo "Uninstalling Media Center packages"
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
pkg_remove "MediaCenter" pkg_remove "MediaCenter"
elif [[ "$ID" =~ ^(debian|ubuntu|linuxmint)$ ]]; then elif [[ "$ID" =~ ^(debian|ubuntu|linuxmint)$ ]]; then