Add --local option to force installation to user bin directory, preventing automatic fallback when sudo is unavailable
This commit is contained in:
@@ -511,6 +511,7 @@ show_usage() {
|
||||
echo " -v, --version Install specific version (default: latest)"
|
||||
echo " -f, --force Force reinstall even if already installed"
|
||||
echo " -r, --reinstall Reinstall the current installed version"
|
||||
echo " -l, --local Force installation to user bin directory (~/.bin)"
|
||||
echo " -p, --package Force installation from package manager"
|
||||
echo " -d, --deb Force installation from DEB package"
|
||||
echo " -t, --tarball Force installation from tarball"
|
||||
@@ -520,6 +521,7 @@ show_usage() {
|
||||
echo " $0 # Install latest version using best method"
|
||||
echo " $0 -v v2.6.0 # Install specific version"
|
||||
echo " $0 --reinstall # Reinstall current version"
|
||||
echo " $0 --local # Force installation to user bin"
|
||||
echo " $0 --package # Force installation from package manager"
|
||||
echo " $0 --deb # Force installation from DEB package"
|
||||
echo " $0 --checks # Check configuration without installing"
|
||||
@@ -556,6 +558,7 @@ main() {
|
||||
local target_version=""
|
||||
local force_reinstall=false
|
||||
local reinstall_current=false
|
||||
local local_install=false
|
||||
local install_method="auto"
|
||||
local checks_only=false
|
||||
|
||||
@@ -578,6 +581,10 @@ main() {
|
||||
reinstall_current=true
|
||||
shift
|
||||
;;
|
||||
-l|--local)
|
||||
local_install=true
|
||||
shift
|
||||
;;
|
||||
-p|--package)
|
||||
install_method="package"
|
||||
shift
|
||||
@@ -643,21 +650,20 @@ main() {
|
||||
# Detect system
|
||||
detect_os
|
||||
ARCH=$(get_arch)
|
||||
|
||||
# Create temporary directory
|
||||
mkdir -p "$TEMP_DIR"
|
||||
|
||||
# Trap cleanup on exit
|
||||
trap cleanup EXIT
|
||||
|
||||
# Installation logic based on method
|
||||
case $install_method in
|
||||
auto)
|
||||
# Try package manager first
|
||||
if install_from_package_manager; then
|
||||
verify_installation
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check for local installation
|
||||
if [[ "$local_install" == "true" ]]; then
|
||||
print_error "Git Credential Manager requires system installation for proper integration"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get latest version if not specified
|
||||
if [[ -z "$target_version" ]]; then
|
||||
get_latest_release
|
||||
target_version="$LATEST_VERSION"
|
||||
else
|
||||
print_status "Using specified version: $target_version"
|
||||
fi
|
||||
|
||||
# Fall back to distribution-specific methods
|
||||
case $OS in
|
||||
|
||||
Reference in New Issue
Block a user