File tree Expand file tree Collapse file tree
user/local/share/towel/bin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,13 +206,23 @@ if [ ! -d "$src/user/local/share/towel" ]; then
206206 exit 1
207207fi
208208
209+ set -e
209210# Source towel-common from the new tarball so towel_install_from_dir reflects
210211# any changes in the release being installed.
211212# shellcheck source=/dev/null
212213source " $src /user/local/share/towel/bin/towel-common"
213214
214- towel_install_from_dir " $src "
215+ backup_current=" ${TOWEL_DATA} .backup.$( date +%s) "
216+ mv " $TOWEL_DATA " " $backup_current " 2> /dev/null || true
217+ trap ' rm -rf "$TOWEL_DATA"; mv "$backup_current" "$TOWEL_DATA" 2>/dev/null' EXIT
215218
219+ towel_install_from_dir " $src " || {
220+ echo 1>&2 " towel update --apply failed: installation error"
221+ exit 1
222+ }
223+
224+ rm -rf " $backup_current "
225+ trap - EXIT
216226echo " towel updated to $latest_version ."
217227echo " Note: distrobox/containers configs were not refreshed."
218228echo " Re-run ./install from the tarball to update those."
You can’t perform that action at this time.
0 commit comments