From ddea6b8a4d22d99352654e082c11a0824e3fb5de Mon Sep 17 00:00:00 2001 From: librelad Date: Mon, 25 May 2026 18:16:35 +0100 Subject: [PATCH] feat(update): route reset/reinstall recovery paths through the release fetch (phase D) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The git-era recovery commands now do the right thing in release mode instead of attempting a clone: - gitReset (libreportal reset / update reset) and runReinstall (CLI/system reset, missing-files recovery): a release branch re-fetches the verified tarball via lpFetchRelease, then refreshes /root/init.sh + ownership. - the CLI wrapper's clone_and_install (libreportal reset): sources fetch.sh and re-fetches the release; falls back to directing the user to the install.sh bootstrap if the helper isn't present. git/local behaviour unchanged. Wrapper still bakes cleanly (no placeholders left). Phases A–D (release build, bootstrap installer, fetch abstraction, release-aware install + update + recovery) are complete and locally verified. Remaining: phase E (host install.sh + channels + tarballs on get.libreportal.org) and a real fresh install on a throwaway box. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- init.sh | 14 ++++++++++++++ scripts/function/run/reinstall_libreportal.sh | 16 ++++++++++++++-- scripts/update/git/reset_git.sh | 12 ++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index 1bfcfc9..dae5b9a 100755 --- a/init.sh +++ b/init.sh @@ -1424,6 +1424,20 @@ clone_and_install() { echo "NOTICE: Local install detected — no Git remote to clone." return 0 fi + if [[ "$CFG_INSTALL_MODE" == "release" ]]; then + if [ -f "$install_scripts_dir/source/fetch.sh" ] && [ -f "$install_scripts_dir/docker/command/run_privileged.sh" ]; then + source "$install_scripts_dir/docker/command/run_privileged.sh" + source "$install_scripts_dir/source/fetch.sh" + if lpFetchRelease; then + echo "SUCCESS: Re-fetched the verified release. Run 'libreportal run' to continue." + else + echo "ERROR: release re-fetch failed." + fi + else + echo "NOTICE: Release install — reinstall via the bootstrap: curl -fsSL /install.sh | sudo bash" + fi + return 0 + fi update_config_values; setup_repo; clone_repo; diff --git a/scripts/function/run/reinstall_libreportal.sh b/scripts/function/run/reinstall_libreportal.sh index 5eb0894..94a1d22 100755 --- a/scripts/function/run/reinstall_libreportal.sh +++ b/scripts/function/run/reinstall_libreportal.sh @@ -1,9 +1,21 @@ #!/bin/bash -runReinstall() +runReinstall() { isHeader "Reinstalling LibrePortal" - + + # Release mode: re-fetch the verified tarball instead of re-cloning from git. + if [[ "$CFG_INSTALL_MODE" == "release" ]]; then + if declare -f lpFetchRelease >/dev/null 2>&1 && lpFetchRelease; then + runSystem cp -f "$script_dir/init.sh" /root/ 2>/dev/null || true + runInstallOp chown -R "$sudo_user_name:$sudo_user_name" "$script_dir" + isSuccessful "Re-fetched the verified release. Run 'libreportal run' to continue." + else + isError "Release re-fetch failed — install unchanged." + fi + return + fi + # Check if this is a local installation if [[ "$CFG_INSTALL_MODE" == "local" ]]; then echo "NOTICE: Local installation detected - cannot reinstall from Git." diff --git a/scripts/update/git/reset_git.sh b/scripts/update/git/reset_git.sh index e74ada4..e890954 100755 --- a/scripts/update/git/reset_git.sh +++ b/scripts/update/git/reset_git.sh @@ -2,6 +2,18 @@ gitReset() { + # Release mode: re-fetch the verified tarball instead of re-cloning. + if [[ "$CFG_INSTALL_MODE" == "release" ]]; then + if declare -f lpFetchRelease >/dev/null 2>&1 && lpFetchRelease; then + runSystem cp -f "$script_dir/init.sh" /root/ 2>/dev/null || true + runInstallOp chown -R "$sudo_user_name:$sudo_user_name" "$script_dir" + isSuccessful "Re-fetched the verified release." + else + isError "Release re-fetch failed — install unchanged." + fi + return + fi + # Check if this is a local installation if [[ "$CFG_INSTALL_MODE" == "local" ]]; then isNotice "Local installation detected - Git reset is not applicable."