From 5f4f4eb96f23af815dcae0979bb9d93221b7402c Mon Sep 17 00:00:00 2001 From: librelad Date: Sun, 24 May 2026 14:48:17 +0100 Subject: [PATCH] feat(switcher): restart the task processor after a docker-type swap The task processor reads CFG_DOCKER_INSTALL_TYPE once at startup to decide how runFileOp writes into the task dir (rootless -> as the docker install user, rooted -> as the manager). After a rooted<->rootless swap a running instance keeps the old mode and writes task files wrong. Add restartLibrePortalWebUITaskService and call it at the end of both switch branches so the processor re-sources the new mode. The switch is a CLI one-shot, not a processor task, so the restart won't interrupt it. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- scripts/docker/type_switcher/swap_docker_type.sh | 2 ++ scripts/webui/webui_install_systemd.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/scripts/docker/type_switcher/swap_docker_type.sh b/scripts/docker/type_switcher/swap_docker_type.sh index ccfcf9f..28e6c5c 100755 --- a/scripts/docker/type_switcher/swap_docker_type.sh +++ b/scripts/docker/type_switcher/swap_docker_type.sh @@ -75,6 +75,7 @@ dockerSwitcherSwap() dockerStartAllApps; databaseOptionInsert "docker_type" $CFG_DOCKER_INSTALL_TYPE; switchMigrateRestoreApps; + restartLibrePortalWebUITaskService; fi fi fi @@ -113,6 +114,7 @@ dockerSwitcherSwap() dockerStartAllApps; databaseOptionInsert "docker_type" $CFG_DOCKER_INSTALL_TYPE; switchMigrateRestoreApps; + restartLibrePortalWebUITaskService; fi fi elif [[ $flag == "cli" ]]; then diff --git a/scripts/webui/webui_install_systemd.sh b/scripts/webui/webui_install_systemd.sh index 9f812d6..d049a78 100755 --- a/scripts/webui/webui_install_systemd.sh +++ b/scripts/webui/webui_install_systemd.sh @@ -72,3 +72,16 @@ EOF fi fi } + +# Restart the task processor after a docker-type switch. The processor reads the +# install type (rooted/rootless) ONCE at startup to decide how runFileOp writes +# into the docker-install-owned task dir, so a running instance keeps using the +# old mode until it's bounced. The switch is a CLI one-shot (not a processor +# task), so this won't kill an in-flight switch. +restartLibrePortalWebUITaskService() +{ + [[ "$CFG_REQUIREMENT_WEBUI_SERVICE" == "true" ]] || return 0 + [[ -f /etc/systemd/system/libreportal.service ]] || return 0 + runSystem systemctl restart libreportal.service 2>/dev/null + isSuccessful "Restarted task processor for $CFG_DOCKER_INSTALL_TYPE Docker mode" +}