Remove duplicate blocks

This commit is contained in:
2022-01-17 12:07:08 -05:00
parent ba20e0cece
commit 82ba1f98e0

View File

@@ -1351,7 +1351,7 @@ service_jriver-createrepo() {
uninstall() { uninstall() {
debug "Running: ${FUNCNAME[0]}" debug "Running: ${FUNCNAME[0]}"
declare service unit f declare service unit f i
if ! askOk "Do you really want to uninstall JRiver Media Center"; then if ! askOk "Do you really want to uninstall JRiver Media Center"; then
echo "Uninstall canceled" echo "Uninstall canceled"
@@ -1361,31 +1361,22 @@ uninstall() {
echo "Stopping and removing all Media Center services" echo "Stopping and removing all Media Center services"
for service in $(compgen -A "function" "service"); do for service in $(compgen -A "function" "service"); do
service="${service##service_}" service="${service##service_}"
SERVICE_TYPE=system setServiceVars "$service"; for i in user system; do
for unit in "$SERVICE_NAME" "$TIMER_NAME"; do SERVICE_TYPE="$i" setServiceVars "$service";
if systemctl_is_active_cmd "$unit" &>/dev/null || for unit in "$SERVICE_NAME" "$TIMER_NAME"; do
systemctl_is_enabled_cmd "$unit" &>/dev/null; then if systemctl_is_active_cmd "$unit" &>/dev/null ||
debug "Disabling $unit" systemctl_is_enabled_cmd "$unit" &>/dev/null; then
systemctl_disable_cmd "$unit" debug "Disabling $unit"
fi systemctl_disable_cmd "$unit"
done fi
for f in "$SERVICE_FNAME" "$TIMER_FNAME"; do done
[[ -f "$f" ]] && debug "Removing $f" && sudo rm -f "$f" for f in "$SERVICE_FNAME" "$TIMER_FNAME"; do
done [[ -f "$f" ]] && debug "Removing $f" && sudo rm -f "$f"
SERVICE_TYPE=user setServiceVars "$service"; done
for unit in "$SERVICE_NAME" "$TIMER_NAME"; do
if systemctl_is_active_cmd "$unit" &>/dev/null ||
systemctl_is_enabled_cmd "$unit" &>/dev/null; then
debug "Disabling $unit"
systemctl_disable_cmd "$unit"
fi
done done
for f in /etc/systemd/system/jriver-*; do for f in /etc/systemd/system/jriver-*; do
sudo rm -f "$f" sudo rm -f "$f"
done done
for f in "$SERVICE_FNAME" "$TIMER_FNAME"; do
[[ -f "$f" ]] && debug "Removing $f" && sudo rm -f "$f"
done
systemctl_reload_cmd systemctl_reload_cmd
done done