From 8f8c3cac3d63153813f9dc14fc722f715a36bdff Mon Sep 17 00:00:00 2001 From: Pepe44DEV Date: Fri, 29 May 2026 18:48:48 +0200 Subject: [PATCH] =?UTF-8?q?homelab-control.sh:=20setup=20wizard=20bei=20fe?= =?UTF-8?q?hlendem=20config=20=E2=80=94=20kein=20l=C3=B6schen=20mehr,=20se?= =?UTF-8?q?tup=20auch=20nach=20installation=20nutzbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dotfiles/hypr/Scripts/homelab-control.sh | 68 +++++++++++++++++++++++- modules/core/dotfiles.sh | 6 --- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/dotfiles/hypr/Scripts/homelab-control.sh b/dotfiles/hypr/Scripts/homelab-control.sh index f3a1c44..aae449d 100755 --- a/dotfiles/hypr/Scripts/homelab-control.sh +++ b/dotfiles/hypr/Scripts/homelab-control.sh @@ -15,12 +15,76 @@ if ! command -v ags >/dev/null 2>&1; then fi if ! command -v sshpass >/dev/null 2>&1; then - notify "sshpass ist nicht installiert." - exit 1 + if command -v gum >/dev/null 2>&1; then + gum confirm "sshpass ist nicht installiert. Installieren?" && sudo pacman -S --noconfirm sshpass || true + else + read -r -p "sshpass ist nicht installiert. Installieren? [Y/n] " response + response="${response:-Y}" + if [[ "$response" =~ ^[yY](es)?$ ]]; then + sudo pacman -S --noconfirm sshpass + fi + fi + if ! command -v sshpass >/dev/null 2>&1; then + notify "sshpass wird benötigt." + exit 1 + fi fi +setup_homelab() { + local server_address server_username server_port + + if command -v gum >/dev/null 2>&1; then + gum style --foreground 212 "Homelab Control Center Setup" + echo + server_address="$(gum input --prompt "Server address: " --placeholder "192.168.1.100")" + [[ -z "$server_address" ]] && { notify "Keine Adresse angegeben."; return 1; } + server_username="$(gum input --prompt "SSH username: " --value "root")" + server_port="$(gum input --prompt "SSH port: " --value "22")" + elif command -v whiptail >/dev/null 2>&1; then + server_address="$(whiptail --inputbox "Server address" 10 60 3>&1 1>&2 2>&3)" || return 1 + [[ -z "$server_address" ]] && { notify "Keine Adresse angegeben."; return 1; } + server_username="$(whiptail --inputbox "SSH username" 10 60 "root" 3>&1 1>&2 2>&3)" || return 1 + server_port="$(whiptail --inputbox "SSH port" 10 60 "22" 3>&1 1>&2 2>&3)" || return 1 + else + echo "=== Homelab Control Center Setup ===" + echo + read -r -p "Server address (IP or domain): " server_address + [[ -z "$server_address" ]] && { echo "Keine Adresse eingegeben."; return 1; } + read -r -p "SSH username [root]: " server_username + server_username="${server_username:-root}" + read -r -p "SSH port [22]: " server_port + server_port="${server_port:-22}" + fi + + mkdir -p "$(dirname "$HOMELAB_CONFIG")" + cat > "$HOMELAB_CONFIG" </dev/null 2>&1 || true +} + if [[ -f "$HOMELAB_CONFIG" ]]; then export HOMELAB_CONFIG +else + notify "Keine Homelab-Konfiguration gefunden. Setup startet..." + if ! setup_homelab; then + exit 1 + fi + export HOMELAB_CONFIG fi cd "$HYPR_DIR" diff --git a/modules/core/dotfiles.sh b/modules/core/dotfiles.sh index af58d5c..e5ffe9a 100755 --- a/modules/core/dotfiles.sh +++ b/modules/core/dotfiles.sh @@ -60,12 +60,6 @@ print(' '.join(items)) copy_path "$source" "$target" done - if [[ ! -f "$HOME/.config/homelab/config.yaml" ]]; then - rm -f "$HOME/.config/hypr/Scripts/homelab-control.sh" - rm -f "$HOME/.config/hypr/ags/homelab.tsx" - rm -f "$HOME/.config/hypr/ags/homelab.css" - fi - if [[ -f "$dotfiles_dir/starship.toml" ]]; then copy_path "$dotfiles_dir/starship.toml" "$HOME/.config/starship.toml" fi