Fix critical and high bugs B1-B6
- B1: Replace recursive get_timezone_mount/get_gpu_devices with literal YAML strings - B3: Expand /home/*/hops glob via compgen -G instead of storing as array literal; fix eval echo ~$SUDO_USER -> getent passwd in uninstall - B4: Correct services source path in setup_firewall (hops_service_definitions.sh -> services) - B5: Replace all ((x++)) with x=$((x + 1)) to avoid set -e abort on zero pre-increment - B6: Add Linux-only guard at top of hops entry point Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -126,17 +126,17 @@ EOF
|
||||
find_homelab_directory() {
|
||||
local POSSIBLE_DIRS=(
|
||||
"$HOME/hops"
|
||||
"/home/*/hops"
|
||||
"/opt/hops"
|
||||
"/srv/hops"
|
||||
)
|
||||
|
||||
# Try to find from running user's home first
|
||||
while IFS= read -r d; do POSSIBLE_DIRS+=("$d"); done < <(compgen -G "/home/*/hops" 2>/dev/null)
|
||||
|
||||
if [[ -n "$SUDO_USER" ]]; then
|
||||
local user_home=$(eval echo "~$SUDO_USER")
|
||||
local user_home
|
||||
user_home=$(getent passwd "$SUDO_USER" | cut -d: -f6)
|
||||
POSSIBLE_DIRS=("$user_home/hops" "${POSSIBLE_DIRS[@]}")
|
||||
fi
|
||||
|
||||
|
||||
HOMELAB_DIR=""
|
||||
for dir in "${POSSIBLE_DIRS[@]}"; do
|
||||
if [[ -f "$dir/docker-compose.yml" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user