From eab9565c496a807d2b1443e5c7d4f43eb38406a7 Mon Sep 17 00:00:00 2001 From: librelad Date: Sun, 24 May 2026 01:51:39 +0100 Subject: [PATCH] fix(switcher): reconcile uses CFG_DOCKER_INSTALL_USER (lowercase var empty in CLI ctx) Bug found via round-trip: after rooted->rootless the WebUI dir stayed libreportal instead of dockerinstall, so the rootless WebUI Exited(137). Cause: reconcile referenced $docker_install_user, which is unset in the CLI/switch context (only $CFG_DOCKER_INSTALL_USER is, like the rootless helper uses) -> chown to an empty user no-op'd. Use ${docker_install_user:-$CFG_DOCKER_INSTALL_USER} (and ${sudo_user_name:-libreportal}) so reconcile resolves the users reliably in any context. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- scripts/function/permission/libreportal_folders.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/function/permission/libreportal_folders.sh b/scripts/function/permission/libreportal_folders.sh index 44df614..aafe379 100755 --- a/scripts/function/permission/libreportal_folders.sh +++ b/scripts/function/permission/libreportal_folders.sh @@ -25,7 +25,8 @@ reconcileDockerOwnership() # The control plane is owned by the MANAGER user in BOTH modes. root:root was # never the intended model — it only ever showed up as an artifact of # un-de-sudo'd commands (sudo creating files as root instead of libreportal). - local owner="$sudo_user_name" + local owner="${sudo_user_name:-libreportal}" + local appusr="${docker_install_user:-$CFG_DOCKER_INSTALL_USER}" # Swap ONLY the owner on our own control-plane files; never reset mode bits # (so nothing that validates its permissions gets surprised). The only two @@ -52,7 +53,7 @@ reconcileDockerOwnership() local webui_dir="${containers_dir}libreportal" if [[ -d "$webui_dir" ]]; then local app_owner="$owner" - [[ "$mode" == "rootless" ]] && app_owner="$docker_install_user" + [[ "$mode" == "rootless" ]] && app_owner="$appusr" runSystem chown -R "$app_owner:$app_owner" "$webui_dir" fi