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 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-24 01:51:39 +01:00
parent b2d57b2774
commit eab9565c49

View File

@ -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