From b4e09213e497c615c1ea25c33f1e3b8987363326 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 17 Nov 2025 22:51:14 +0800 Subject: [PATCH] fix(installer): prevent deletion of current manifest in Bash version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: - In Bash version, new_install_manifest creates file immediately - save_install_manifest calls remove_old_manifests_for_path - This deletes ALL manifests for the path, including the new one - Result: "WARNING: Failed to save installation manifest" Solution: - Add current_manifest_file parameter to remove_old_manifests_for_path - Skip deletion if file matches current manifest - Pass manifest_file to exclude it from deletion Note: PowerShell version does not have this issue because it creates the manifest file AFTER deleting old ones (hashtable → file conversion) --- Install-Claude.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Install-Claude.sh b/Install-Claude.sh index c069b65d..c89b5e09 100644 --- a/Install-Claude.sh +++ b/Install-Claude.sh @@ -976,6 +976,7 @@ EOF function remove_old_manifests_for_path() { local installation_path="$1" + local current_manifest_file="$2" # Optional: exclude this file from deletion if [ ! -d "$MANIFEST_DIR" ]; then return 0 @@ -987,6 +988,11 @@ function remove_old_manifests_for_path() { # Find and remove old manifests for the same installation path while IFS= read -r -d '' file; do + # Skip the current manifest file if specified + if [ -n "$current_manifest_file" ] && [ "$file" = "$current_manifest_file" ]; then + continue + fi + local manifest_path=$(jq -r '.installation_path // ""' "$file" 2>/dev/null) if [ -n "$manifest_path" ]; then @@ -1013,9 +1019,9 @@ function save_install_manifest() { local manifest_file="$1" local installation_path="$2" - # Remove old manifests for the same installation path + # Remove old manifests for the same installation path (excluding current one) if [ -n "$installation_path" ]; then - remove_old_manifests_for_path "$installation_path" + remove_old_manifests_for_path "$installation_path" "$manifest_file" fi if [ -f "$manifest_file" ]; then