fix(switcher): read rootless install user authoritatively from config, not the mode-polluted global

ROOT CAUSE of the WebUI-dir misownership on rooted->rootless:
check_install_type.sh sets the lowercase $docker_install_user to the MANAGER
user in rooted mode (it's a mode-dependent 'container owner' var). reconcile
trusted it, so mid-switch it held the stale rooted value (=manager) and chowned
the rootless WebUI dir to libreportal -> WebUI Exited(137) -> dockerStartAllApps
retried forever (the 'switch hangs' symptom). Now read CFG_DOCKER_INSTALL_USER
straight from the live config file (authoritative, never polluted), falling back
to the CFG var then a hard default.

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 02:23:00 +01:00
parent ad902c6478
commit 03afcfa4f1

View File

@ -35,9 +35,13 @@ reconcileDockerOwnership()
local logdir="${logs_dir:-$ddir/logs/}"
local scrdir="${script_dir:-$ddir/install}"
local dbpath="$ddir/${db_file:-database.db}"
local appusr="${docker_install_user:-${CFG_DOCKER_INSTALL_USER:-}}"
[[ -z "$appusr" ]] && appusr=$(grep -h '^CFG_DOCKER_INSTALL_USER=' "$cfgdir/general/general_docker_install" 2>/dev/null | head -1 | cut -d= -f2 | awk '{print $1}')
appusr="${appusr:-dockerinstall}"
# Read the rootless docker install user AUTHORITATIVELY from config — NOT the
# lowercase $docker_install_user global, which check_install_type.sh sets to
# the MANAGER user in rooted mode, so during a rooted->rootless switch it's
# stale (=manager) and would mis-own the WebUI dir.
local appusr
appusr=$(grep -h '^CFG_DOCKER_INSTALL_USER=' "$cfgdir/general/general_docker_install" 2>/dev/null | head -1 | cut -d= -f2 | awk '{print $1}')
appusr="${appusr:-${CFG_DOCKER_INSTALL_USER:-dockerinstall}}"
[[ -d "$ddir" ]] || return 0