Change installer scripts to prefer system-wide installation in /usr/local/bin, warn about user bin precedence, and offer to remove user bin versions after successful system installation

This commit is contained in:
kdusek
2025-11-13 17:49:01 +01:00
parent fbaebfaae2
commit 979977d16e
3 changed files with 133 additions and 39 deletions

View File

@@ -16,6 +16,7 @@ NC='\033[0m' # No Color
# Configuration
GITHUB_REPO="git-ecosystem/git-credential-manager"
INSTALL_DIR="/usr/local/bin"
USER_BIN_DIR="$HOME/bin"
TEMP_DIR="/tmp/gcm-install"
# Function to print colored output
@@ -451,6 +452,19 @@ verify_installation() {
# Check all presets
configure_git_presets
# Check for user bin version and offer removal
if [[ -f "$USER_BIN_DIR/git-credential-manager" ]]; then
print_warning "Found git-credential-manager in user bin directory ($USER_BIN_DIR)"
print_status "This might take precedence if $USER_BIN_DIR is in PATH before system paths"
echo
read -p "Would you like to remove the user bin version? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -f "$USER_BIN_DIR/git-credential-manager"
print_success "Removed user bin version"
fi
fi
return 0
else
print_error "git-credential-manager installation verification failed"