fix(init): skip the routine update check on the first install run

Triage of a broken fresh install:
  1. init.sh → all root setup → completeInitMessage hands off to
     `libreportal run install` as the manager.
  2. start.sh sources load_sources.sh, which calls sourceCheckFiles "run".
  3. sourceCheckFiles "run" calls checkUpdates — its only path to startLoad on
     a non-local mode is via the git/release recovery branches.
  4. git fails (the deployed install dir has no .git), lpFetchRelease fails (no
     reachable release manifest), none of the recovery branches converge on
     startLoad, and the install silently exits with WebUI + service unset.

Fix: completeInitMessage exports LIBREPORTAL_INITIAL_INSTALL=1, and the
sourceCheckFiles "run" branch calls startLoad directly when that's set — same
endpoint the local-mode branch hits. We just installed the latest code from
this tree; checking for updates on the first run was nonsensical and the
recovery gauntlet would only break things.

Confirmed by re-running uninstall + install: the install now reaches the
Pre-Installation / database / WebUI build / crontab / WebUI compose-up steps
and produces a working WebUI. (A separate compose-tag bug surfaced next —
fixed in the follow-up commit.)

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-26 17:26:40 +01:00
parent 9ef335509c
commit d4bab9bb1b
2 changed files with 19 additions and 2 deletions

View File

@ -1574,7 +1574,13 @@ completeInitMessage()
isNotice "Starting LibrePortal installation as $sudo_user_name user..." isNotice "Starting LibrePortal installation as $sudo_user_name user..."
# Switch to libreportal user and run the install command # Switch to libreportal user and run the install command
if sudo -u "$sudo_user_name" LIBREPORTAL_SKIP_LOGO=1 bash -c "libreportal run install"; then # LIBREPORTAL_INITIAL_INSTALL=1 tells the runtime entry (check_files.sh) to
# skip the routine update check on this very first run — we just installed
# the latest code from this very tree, and the update path would otherwise
# try to git-pull (no .git in the deployed install dir) or lpFetchRelease
# (no release manifest reachable yet), failing in ways that leave the
# WebUI / task-processor uninstalled.
if sudo -u "$sudo_user_name" LIBREPORTAL_SKIP_LOGO=1 LIBREPORTAL_INITIAL_INSTALL=1 bash -c "libreportal run install"; then
# Install done — tighten the manager's broad install-phase sudo down to # Install done — tighten the manager's broad install-phase sudo down to
# the scoped runtime allowlist. # the scoped runtime allowlist.
initScopedSudoers initScopedSudoers

View File

@ -20,7 +20,18 @@ sourceCheckFiles()
if [[ $flag == "run" ]]; then if [[ $flag == "run" ]]; then
isSuccessful "All files found and loaded for startup." isSuccessful "All files found and loaded for startup."
detectOS; detectOS;
checkUpdates; # Fresh install (set by init.sh's completeInitMessage handoff): skip
# the routine update check and go straight to startLoad. We just
# installed the latest code — the update path's git-pull / release
# re-fetch would fail on a tree without .git or a reachable manifest
# and leave the WebUI / task-processor uninstalled. All of
# checkUpdates' own success branches converge on startLoad anyway;
# we just bypass the recovery gauntlet that doesn't apply here.
if [[ "$LIBREPORTAL_INITIAL_INSTALL" == "1" ]]; then
startLoad
else
checkUpdates
fi
# This is where the CLI command starts # This is where the CLI command starts
elif [[ $flag == "cli" ]]; then elif [[ $flag == "cli" ]]; then
detectOS; detectOS;