diff --git a/install.sh b/install.sh index c4e68e0..7c045f9 100755 --- a/install.sh +++ b/install.sh @@ -144,6 +144,9 @@ resolve_source_dir() { if [[ -z "$branch" ]]; then branch="main" fi + if [[ "$branch" != "main" ]]; then + branch="$(normalize_release_tag "$branch")" + fi local url="https://github.com/tw93/mole/archive/refs/heads/main.tar.gz" # If a specific version is requested (e.g. V1.0.0), use the tag URL @@ -233,6 +236,15 @@ get_latest_release_tag_from_git() { tail -n 1 } +normalize_release_tag() { + local tag="$1" + tag="${tag#v}" + tag="${tag#V}" + if [[ -n "$tag" ]]; then + printf 'V%s\n' "$tag" + fi +} + get_installed_version() { local binary="$INSTALL_DIR/mole" if [[ -x "$binary" ]]; then diff --git a/mole b/mole index 6c3b765..1ac5cf0 100755 --- a/mole +++ b/mole @@ -25,7 +25,7 @@ source "$SCRIPT_DIR/lib/core/common.sh" trap cleanup_temp_files EXIT INT TERM # Version info -VERSION="1.15.10" +VERSION="1.16.0" MOLE_TAGLINE="Deep clean and optimize your Mac." # Check TouchID configuration @@ -430,11 +430,12 @@ update_mole() { # Run installer with visible output (but capture for error handling) local install_output - if install_output=$(MOLE_VERSION="V${latest}" "$tmp_installer" --prefix "$install_dir" --config "$HOME/.config/mole" --update 2>&1); then + local update_tag="V${latest#V}" + if install_output=$(MOLE_VERSION="$update_tag" "$tmp_installer" --prefix "$install_dir" --config "$HOME/.config/mole" --update 2>&1); then process_install_output "$install_output" else # Retry without --update flag - if install_output=$(MOLE_VERSION="V${latest}" "$tmp_installer" --prefix "$install_dir" --config "$HOME/.config/mole" 2>&1); then + if install_output=$(MOLE_VERSION="$update_tag" "$tmp_installer" --prefix "$install_dir" --config "$HOME/.config/mole" 2>&1); then process_install_output "$install_output" else if [[ -t 1 ]]; then stop_inline_spinner; fi