From 13eeb55434024b549638c37250c2a6265edac850 Mon Sep 17 00:00:00 2001 From: Mike Felida Date: Wed, 20 May 2026 16:58:52 +0200 Subject: [PATCH] fix: Towel scripts got reloaded when update changes them. mv current current before installing new version --- user/local/share/towel/bin/towel-update | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/user/local/share/towel/bin/towel-update b/user/local/share/towel/bin/towel-update index 2ba1b5c..ae5d0ae 100755 --- a/user/local/share/towel/bin/towel-update +++ b/user/local/share/towel/bin/towel-update @@ -206,13 +206,23 @@ if [ ! -d "$src/user/local/share/towel" ]; then exit 1 fi +set -e # Source towel-common from the new tarball so towel_install_from_dir reflects # any changes in the release being installed. # shellcheck source=/dev/null source "$src/user/local/share/towel/bin/towel-common" -towel_install_from_dir "$src" +backup_current="${TOWEL_DATA}.backup.$(date +%s)" +mv "$TOWEL_DATA" "$backup_current" 2>/dev/null || true +trap 'rm -rf "$TOWEL_DATA"; mv "$backup_current" "$TOWEL_DATA" 2>/dev/null' EXIT +towel_install_from_dir "$src" || { + echo 1>&2 "towel update --apply failed: installation error" + exit 1 +} + +rm -rf "$backup_current" +trap - EXIT echo "towel updated to $latest_version." echo "Note: distrobox/containers configs were not refreshed." echo " Re-run ./install from the tarball to update those."