From 3294ca4e415fe1bc71596458d9e0cc4758d8a593 Mon Sep 17 00:00:00 2001 From: librelad Date: Wed, 27 May 2026 14:58:43 +0100 Subject: [PATCH] fix(boot): source run_privileged.sh before checkConfigFilesMissingFiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit load_sources.sh calls checkConfigFilesMissingFiles() after init.sh + variables.sh but BEFORE initilize_files.sh sources the function manifest. checkConfigFilesMissingFiles uses runInstallOp (in docker/command/run_privileged.sh) to copy missing config templates — under LP_LAZY=1 that's an autoload stub that only exists once the manifest is sourced. So when any template is genuinely missing, the copy call hits "runInstallOp: command not found" and the file silently never gets copied. Symptom on a fresh CLI invocation (foreground or processor subprocess inheriting LIBREPORTAL_TASK_EXEC=1) where a new config category was added: config_check_missing.sh: line 33: runInstallOp: command not found ✓ Success 1 config files were missing and have been added to the configs folder. ← false success: the count incremented but the copy itself didn't happen Fix: source run_privileged.sh directly in load_sources.sh just before the missing-files check. The file is pure function definitions (runAsManager / runFileOp / runFileWrite / runInstallOp / runInstallWrite), no side effects, ~150 lines — safe to source unconditionally and idempotent with the eager/lazy load that happens later. Adds <1ms to every CLI invocation; saves silent failures on the rare path that calls it. Signed-off-by: librelad --- scripts/source/load_sources.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/source/load_sources.sh b/scripts/source/load_sources.sh index 465459c..96ebee9 100755 --- a/scripts/source/load_sources.sh +++ b/scripts/source/load_sources.sh @@ -14,6 +14,16 @@ else echo "Files are missing, please run 'libreportal reset'" fi +# checkConfigFilesMissingFiles uses runInstallOp (in docker/command/run_privileged.sh) +# to copy any missing config templates into place. That file's autoload stub +# isn't defined until the function manifest is sourced inside initilize_files.sh +# — which we haven't called yet at this point in load_sources. Source the +# privileged helpers eagerly so the reconciliation can do its work on a fresh +# install or after a config-template drift. The file is pure function defs; +# safe to source unconditionally. +[ -f "${install_scripts_dir}docker/command/run_privileged.sh" ] && \ + source "${install_scripts_dir}docker/command/run_privileged.sh" + # Source config check if [ -f "${install_scripts_dir}config/core/config_check_missing.sh" ]; then source "${install_scripts_dir}config/core/config_check_missing.sh"