fix(setup): correctly auto-detect username when using --full (#11650)

Argument parsing prevented auto-detection from running when --full
was supplied without an explicit username. After shifting --full,
no positional arguments remained, but the script had already skipped
the auto-detection branch, leaving USERNAME empty and causing the
script to abort.
This commit is contained in:
ls-root
2026-02-07 19:44:47 +01:00
committed by GitHub
parent fd7095a133
commit e27dc1cebb
+12 -10
View File
@@ -237,7 +237,6 @@ if [[ $# -gt 0 ]]; then
# Check for --full flag # Check for --full flag
if [[ "$1" == "--full" ]]; then if [[ "$1" == "--full" ]]; then
UPDATE_ALL=true UPDATE_ALL=true
AUTO_DETECT=true
shift # Remove --full from arguments shift # Remove --full from arguments
fi fi
@@ -250,8 +249,10 @@ if [[ $# -gt 0 ]]; then
REPO_NAME="$2" REPO_NAME="$2"
fi fi
fi fi
else fi
# Try auto-detection
# Try auto-detection
if [[ -z "$USERNAME" ]]; then
if username=$(detect_username); then if username=$(detect_username); then
USERNAME="$username" USERNAME="$username"
print_success "Detected GitHub username: $USERNAME" print_success "Detected GitHub username: $USERNAME"
@@ -261,14 +262,15 @@ else
echo " ./setup-fork.sh YOUR_USERNAME" echo " ./setup-fork.sh YOUR_USERNAME"
exit 1 exit 1
fi fi
fi
if repo_name=$(detect_repo_name); then # Auto-detect repo name if needed
REPO_NAME="$repo_name" if repo_name=$(detect_repo_name); then
if [[ "$REPO_NAME" != "ProxmoxVE" ]]; then REPO_NAME="$repo_name"
print_info "Detected custom repo name: $REPO_NAME" if [[ "$REPO_NAME" != "ProxmoxVE" ]]; then
else print_info "Detected custom repo name: $REPO_NAME"
print_success "Using default repo name: ProxmoxVE" else
fi print_success "Using default repo name: ProxmoxVE"
fi fi
fi fi