Fix permission denied when removing existing borg binary during system installation
- Add sudo prefix to rm command when installing system-wide - Clean up outdated README files
This commit is contained in:
@@ -279,9 +279,6 @@ check_version_symlink() {
|
||||
# Function to determine installation strategy
|
||||
determine_install_strategy() {
|
||||
local local_install="$1"
|
||||
local current_info=$(get_current_version)
|
||||
local current_version=$(echo "$current_info" | cut -d: -f1)
|
||||
local install_type=$(echo "$current_info" | cut -d: -f2)
|
||||
|
||||
# Strategy: Check installation type preference
|
||||
if [[ "$local_install" == "true" ]]; then
|
||||
@@ -325,40 +322,6 @@ determine_install_strategy() {
|
||||
print_status "This might take precedence if $USER_BIN_DIR is in PATH before system paths"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_warning "Sudo not available, using user installation"
|
||||
fi
|
||||
|
||||
# If not system install, check user bin
|
||||
if [[ "$INSTALL_STRATEGY" != "system_install" ]]; then
|
||||
print_status "No sudo access, checking user bin directory"
|
||||
if check_user_bin_setup; then
|
||||
print_status "User bin directory is available and in PATH"
|
||||
|
||||
# Check if borg exists in user bin
|
||||
if [[ -f "$USER_BIN_DIR/borg" ]]; then
|
||||
print_status "Borg CLI found in user bin directory"
|
||||
|
||||
# Check for version symlink
|
||||
if check_version_symlink; then
|
||||
print_status "Version symlink found: $CURRENT_SYMLINK_VERSION"
|
||||
INSTALL_STRATEGY="user_update"
|
||||
TARGET_DIR="$USER_BIN_DIR"
|
||||
else
|
||||
print_status "No version symlink found, will create one"
|
||||
INSTALL_STRATEGY="user_upgrade"
|
||||
TARGET_DIR="$USER_BIN_DIR"
|
||||
fi
|
||||
else
|
||||
print_status "Borg CLI not found in user bin, will install there"
|
||||
INSTALL_STRATEGY="user_install"
|
||||
TARGET_DIR="$USER_BIN_DIR"
|
||||
fi
|
||||
else
|
||||
print_error "Cannot install system-wide (no sudo) and user bin not available"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
print_status "Installation strategy: $INSTALL_STRATEGY"
|
||||
print_status "Target directory: $TARGET_DIR"
|
||||
@@ -418,7 +381,11 @@ install_borg_from_binary() {
|
||||
fi
|
||||
|
||||
# Remove any existing borg symlink or file to avoid conflicts
|
||||
rm -f "$TARGET_DIR/borg"
|
||||
if [[ "$TARGET_DIR" == "$SYSTEM_INSTALL_DIR" ]]; then
|
||||
sudo rm -f "$TARGET_DIR/borg"
|
||||
else
|
||||
rm -f "$TARGET_DIR/borg"
|
||||
fi
|
||||
|
||||
# Create/update symlink to point to this version
|
||||
$symlink_cmd "$TARGET_DIR/borg-$version" "$TARGET_DIR/borg"
|
||||
|
||||
Reference in New Issue
Block a user