From 04a68df15c3bbc830fd5a919f5dae42ed5f27fbc Mon Sep 17 00:00:00 2001 From: DragonSlayer_14 Date: Sun, 6 Sep 2026 12:05:35 +0200 Subject: [PATCH] Feat: Hyprland-Desktop mit Debian-Hyprland-Installer und interaktivem Dotfiles-Setup Co-authored-by: Junie --- AGENTS.md | 2 +- README.md | 2 +- config/packages/01-base.list | 1 + data/skel/.config/hypr/hyprland.conf | 97 ++++++++ .../hypr/scripts/install-dots-prompt.sh | 230 ++++++++++++++++++ lib/tui.sh | 2 +- lib/utils.sh | 10 +- stages/07-skel-and-user.sh | 23 +- stages/08-flatpaks-apps.sh | 1 - stages/09-hyprland.sh | 55 ++++- 10 files changed, 399 insertions(+), 24 deletions(-) create mode 100644 data/skel/.config/hypr/hyprland.conf create mode 100755 data/skel/.config/hypr/scripts/install-dots-prompt.sh diff --git a/AGENTS.md b/AGENTS.md index f8d7b8c..fae4a42 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -44,7 +44,7 @@ Dieses Repository ist ein modulares, automatisiertes Setup- und Konfigurations-F │ ├── 06-services.sh # Aktivierung von AppArmor, Docker, Libvirt, zram │ ├── 07-skel-and-user.sh # /etc/skel Vorlagen, ZSH-Shell-Setzen, Dotfiles-Sync │ ├── 08-flatpaks-apps.sh # Flathub Setup, Flatpaks, Spotify, Waydroid, MIME-Types -│ └── 09-hyprland.sh # LinuxBeginnings Debian-Hyprland Auto-Installer +│ └── 09-hyprland.sh # LinuxBeginnings Debian-Hyprland Auto-Installer & Desktop-Setup ├── data/ # Statische Konfigurationsdateien & Vorlagen │ ├── apt/ │ │ ├── sources.list.d/ # Deb822-Quellen (debian-unstable.sources, xanmod.sources) diff --git a/README.md b/README.md index e65084e..2a4ec5c 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ sudo ./setup.sh --stages 04,05 ├── etc/ │ ├── environment.d/ # 99-raytracing.conf, 99-upscaling.conf │ └── profile.d/ # Bereinigte System-Profile-Skripte - ├── skel/ # .zshrc, Templates für Dokumente & Skripte + ├── skel/ # .zshrc, .config/hypr, Templates für Dokumente & Skripte └── usr/share/applications/ # Desktop-Dateien (z. B. Spotify) ``` diff --git a/config/packages/01-base.list b/config/packages/01-base.list index 9d0db80..5551f8f 100644 --- a/config/packages/01-base.list +++ b/config/packages/01-base.list @@ -33,6 +33,7 @@ firmware-misc-nonfree flatpak flatseal fzf +git glances gnome-disk-utility gnome-firmware diff --git a/data/skel/.config/hypr/hyprland.conf b/data/skel/.config/hypr/hyprland.conf new file mode 100644 index 0000000..73c5f76 --- /dev/null +++ b/data/skel/.config/hypr/hyprland.conf @@ -0,0 +1,97 @@ +# ============================================================================== +# Rudimentäre Hyprland-Konfiguration (Standard für neue Benutzer) +# ============================================================================== + +# Monitor Setup (Standard: Automatische Auflösung & Positionierung) +monitor = , preferred, auto, 1 + +# Modifikator-Taste: SUPER (Windows-Taste) +$mainMod = SUPER + +# Standard-Terminal +$terminal = kitty + +# ------------------------------------------------------------------------------ +# Tastenbelegungen (Keybindings) +# ------------------------------------------------------------------------------ +# SUPER + ENTER: Kitty Terminal öffnen +bind = $mainMod, RETURN, exec, $terminal +bind = $mainMod, Return, exec, $terminal + +# SUPER + Q: Aktives Fenster schließen +bind = $mainMod, Q, killactive, + +# Grundlegende Navigation & Fensterverwaltung +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, thunar +bind = $mainMod, V, togglefloating, +bind = $mainMod, F, fullscreen, + +# Fokus mit Pfeiltasten wechseln +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Workspaces 1-10 wechseln +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Aktives Fenster auf Workspace 1-10 verschieben +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Fenster mit Maus bewegen und vergrößern/verkleinern +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +# ------------------------------------------------------------------------------ +# Erscheinungsbild & Verhalten +# ------------------------------------------------------------------------------ +general { + gaps_in = 4 + gaps_out = 8 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + layout = dwindle +} + +decoration { + rounding = 8 +} + +animations { + enabled = yes +} + +input { + kb_layout = de + follow_mouse = 1 + touchpad { + natural_scroll = yes + } +} + +# ------------------------------------------------------------------------------ +# Autostart nach der Anmeldung +# ------------------------------------------------------------------------------ +# Fragt nach der ersten Anmeldung nach der gewünschten Dotfiles-Konfiguration +# (LinuxBeginnings Hyprland-Dots oder eigenes Git-Repository für ~/.config) +exec-once = ~/.config/hypr/scripts/install-dots-prompt.sh diff --git a/data/skel/.config/hypr/scripts/install-dots-prompt.sh b/data/skel/.config/hypr/scripts/install-dots-prompt.sh new file mode 100755 index 0000000..0af1d6f --- /dev/null +++ b/data/skel/.config/hypr/scripts/install-dots-prompt.sh @@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# ============================================================================== +# ~/.config/hypr/scripts/install-dots-prompt.sh +# Fragt nach der Anmeldung nach der gewünschten Dotfiles-Konfiguration: +# 1) LinuxBeginnings Hyprland-Dotfiles (GitHub) +# 2) Eigenes Git-Repository als ~/.config klonen +# 3) Überspringen (rudimentäre Basiskonfiguration beibehalten) +# ============================================================================== + +set -euo pipefail + +MARKER_FILE="$HOME/.config/hypr/.dots_prompted" +FORCE=0 + +for arg in "$@"; do + case "$arg" in + -f|--force) + FORCE=1 + ;; + esac +done + +# Wenn bereits abgefragt und kein --force übergeben wurde, beenden +if [[ "$FORCE" -eq 0 && -f "$MARKER_FILE" ]]; then + exit 0 +fi + +# Wenn nicht in einem interaktiven Terminal ausgeführt (z. B. via Hyprland exec-once), +# starte das Skript in einem Kitty-Fenster: +if [[ ! -t 0 || ! -t 1 ]]; then + if command -v kitty >/dev/null 2>&1; then + exec kitty --title "Dotfiles Setup & Konfiguration" bash -c "$0 --in-terminal; echo; read -r -p 'Drücke Enter zum Schließen...' || true" + else + exit 0 + fi +fi + +# ANSI Farben +CLR_RESET='\033[0m' +CLR_BOLD='\033[1m' +CLR_CYAN='\033[0;36m' +CLR_GREEN='\033[0;32m' +CLR_YELLOW='\033[0;33m' +CLR_RED='\033[0;31m' +CLR_BLUE='\033[0;34m' +CLR_MAGENTA='\033[0;35m' + +mark_as_prompted() { + mkdir -p "$(dirname "$MARKER_FILE")" 2>/dev/null || true + touch "$MARKER_FILE" 2>/dev/null || true +} + +install_linuxbeginnings() { + printf "\n" + printf "%b\n" "${CLR_GREEN}${CLR_BOLD}[INFO] Starte Installation der LinuxBeginnings Hyprland-Dotfiles...${CLR_RESET}" + printf "\n" + if command -v curl >/dev/null 2>&1; then + mark_as_prompted + sh <(curl -fsSL https://raw.githubusercontent.com/LinuxBeginnings/Hyprland-Dots/main/Distro-Hyprland.sh) + else + printf "%b\n" "${CLR_RED}[FEHLER] 'curl' ist nicht installiert. Bitte installieren Sie curl und wiederholen Sie den Vorgang.${CLR_RESET}" + fi +} + +clone_custom_repo() { + if ! command -v git >/dev/null 2>&1; then + printf "\n%b\n" "${CLR_RED}[FEHLER] 'git' ist nicht installiert. Bitte installieren Sie git zuerst.${CLR_RESET}" + return 1 + fi + + while true; do + printf "\n" + printf "%b\n" "${CLR_BOLD}${CLR_CYAN}--- Eigenes Git-Repository für ~/.config klonen ---${CLR_RESET}" + printf "%b\n" "Geben Sie die Git-URL Ihres Dotfiles-/Config-Repositories an." + printf "%b\n" "Beispiele:" + printf "%b\n" " HTTPS : ${CLR_BLUE}https://github.com/Benutzername/mein-config-repo.git${CLR_RESET}" + printf "%b\n" " SSH : ${CLR_BLUE}git@github.com:Benutzername/mein-config-repo.git${CLR_RESET}" + printf "\n" + printf "%b\n" "${CLR_YELLOW}Hinweise zur Authentifizierung:${CLR_RESET}" + printf "%b\n" " - ${CLR_BOLD}HTTPS:${CLR_RESET} Bei privaten Repositories fragt Git nach Benutzername & Personal Access Token (PAT)." + printf "%b\n" " - ${CLR_BOLD}SSH:${CLR_RESET} Erfordert einen hinterlegten SSH-Schlüssel (z. B. in ~/.ssh/ oder via ssh-agent)." + printf "\n" + + read -r -p "Git-Repository-URL (oder 'q' zum Abbrechen): " repo_url + repo_url="$(echo "$repo_url" | xargs)" + + if [[ "$repo_url" == "q" || "$repo_url" == "Q" || -z "$repo_url" ]]; then + printf "%b\n" "${CLR_YELLOW}[INFO] Vorgang abgebrochen. Kehre zum Hauptmenü zurück.${CLR_RESET}" + return 0 + fi + + # SSH-Prüfung und Hilfestellung + if [[ "$repo_url" =~ ^git@ || "$repo_url" =~ ^ssh:// ]]; then + local ssh_keys_found=0 + if [[ -d "$HOME/.ssh" ]]; then + for k in "$HOME/.ssh"/id_*; do + if [[ -f "$k" && ! "$k" =~ \.pub$ ]]; then + ssh_keys_found=1 + break + fi + done + fi + + if [[ "$ssh_keys_found" -eq 0 ]]; then + printf "\n" + printf "%b\n" "${CLR_YELLOW}[WARNUNG] Es wurde kein lokaler SSH-Privatschlüssel in ~/.ssh/ gefunden.${CLR_RESET}" + read -r -p "Möchten Sie vor dem Klonen ein neues SSH-Schlüsselpaar (ed25519) generieren? [j/N]: " gen_ssh || gen_ssh="n" + if [[ "$gen_ssh" =~ ^[JjYy] ]]; then + mkdir -p "$HOME/.ssh" + chmod 700 "$HOME/.ssh" + ssh-keygen -t ed25519 -f "$HOME/.ssh/id_ed25519" -C "$USER@$(hostname)" + printf "\n%b\n" "${CLR_GREEN}Neuer öffentlicher SSH-Schlüssel (~/.ssh/id_ed25519.pub):${CLR_RESET}" + cat "$HOME/.ssh/id_ed25519.pub" + printf "\n%b\n" "Bitte fügen Sie diesen Schlüssel bei GitHub/GitLab zu Ihrem Account hinzu." + if command -v wl-copy >/dev/null 2>&1; then + if wl-copy < "$HOME/.ssh/id_ed25519.pub" 2>/dev/null; then + printf "%b\n" "${CLR_GREEN}(In die Zwischenablage kopiert!)${CLR_RESET}" + fi + fi + read -r -p "Drücken Sie Enter, sobald der SSH-Key hinterlegt wurde..." + fi + fi + fi + + # Backup und Klon-Vorgang vorbereiten + local timestamp + timestamp="$(date +%Y%m%d_%H%M%S)" + local backup_dir="$HOME/.config.backup_$timestamp" + + printf "\n" + printf "%b\n" "${CLR_CYAN}[1/3] Sichere bestehendes ~/.config-Verzeichnis nach ${backup_dir}...${CLR_RESET}" + + if [[ -d "$HOME/.config" ]]; then + mv "$HOME/.config" "$backup_dir" + fi + + printf "%b\n" "${CLR_CYAN}[2/3] Klone Repository direkt nach ~/.config...${CLR_RESET}" + + # Git ausführen mit aktivierter Terminal-Eingabeaufforderung für Authentifizierung + if env GIT_TERMINAL_PROMPT=1 git clone --recurse-submodules "$repo_url" "$HOME/.config"; then + printf "\n" + printf "%b\n" "${CLR_GREEN}${CLR_BOLD}[ERFOLG] Repository wurde erfolgreich nach ~/.config geklont!${CLR_RESET}" + printf "%b\n" " - Ihr gesamter ${CLR_BOLD}~/.config${CLR_RESET}-Ordner ist nun das Git-Repository." + printf "%b\n" " - Vorherige Konfigurationen wurden gesichert in: ${CLR_BOLD}${backup_dir}${CLR_RESET}" + + mark_as_prompted + + # Hyprland-Konfiguration neu laden falls aktiv + if command -v hyprctl >/dev/null 2>&1; then + printf "\n" + printf "%b\n" "${CLR_CYAN}[3/3] Lade Hyprland-Konfiguration neu...${CLR_RESET}" + hyprctl reload 2>/dev/null || true + printf "%b\n" "${CLR_GREEN}[✓] Hyprland erfolgreich aktualisiert.${CLR_RESET}" + fi + + printf "\n" + printf "%b\n" "${CLR_GREEN}Einrichtung abgeschlossen!${CLR_RESET}" + return 0 + else + printf "\n" + printf "%b\n" "${CLR_RED}${CLR_BOLD}[FEHLER] Git Clone ist fehlgeschlagen (Authentifizierungsfehler, falsche URL oder Netzwerkproblem).${CLR_RESET}" + printf "%b\n" "${CLR_YELLOW}[ROLLBACK] Stelle vorheriges ~/.config-Verzeichnis aus dem Backup wieder her...${CLR_RESET}" + rm -rf "$HOME/.config" 2>/dev/null || true + if [[ -d "$backup_dir" ]]; then + mv "$backup_dir" "$HOME/.config" + printf "%b\n" "${CLR_GREEN}[✓] Ursprüngliches ~/.config-Verzeichnis wurde vollständig wiederhergestellt.${CLR_RESET}" + fi + + printf "\n" + read -r -p "Möchten Sie es erneut versuchen? [J/n]: " retry || retry="n" + if [[ ! "$retry" =~ ^[JjYy] && -n "$retry" ]]; then + return 0 + fi + fi + done +} + +clear 2>/dev/null || true +printf "%b\n" "${CLR_BOLD}${CLR_CYAN}==============================================================================${CLR_RESET}" +printf "%b\n" "${CLR_BOLD}${CLR_CYAN} Hyprland Desktop - Dotfiles Setup & Konfiguration ${CLR_RESET}" +printf "%b\n" "${CLR_BOLD}${CLR_CYAN}==============================================================================${CLR_RESET}" +printf "\n" +printf "%b\n" "Willkommen auf Ihrem neuen Debian Unstable Hyprland-System!" +printf "\n" +printf "%b\n" "Aktuell ist eine rudimentäre Basiskonfiguration aktiv:" +printf "%b\n" " - ${CLR_BOLD}SUPER + ENTER${CLR_RESET} : Terminal (Kitty) öffnen" +printf "%b\n" " - ${CLR_BOLD}SUPER + Q${CLR_RESET} : Aktives Fenster schließen" +printf "\n" +printf "%b\n" "Wie möchten Sie Ihre Desktop-Konfiguration (Dotfiles) einrichten?" +printf "\n" +printf "%b\n" " ${CLR_BOLD}[1]${CLR_RESET} ${CLR_GREEN}LinuxBeginnings Hyprland-Dotfiles installieren${CLR_RESET}" +printf "%b\n" " Vollständig vorkonfiguriertes Setup (Waybar, Rofi, Animationen, Themes)" +printf "%b\n" " URL: https://github.com/LinuxBeginnings/Hyprland-Dots" +printf "\n" +printf "%b\n" " ${CLR_BOLD}[2]${CLR_RESET} ${CLR_MAGENTA}Eigenes Git-Repository als ~/.config klonen${CLR_RESET}" +printf "%b\n" " Klont Ihr eigenes Git-Repository direkt als vollständigen ~/.config-Ordner." +printf "%b\n" " (Unterstützt HTTPS & SSH inkl. Authentifizierung)" +printf "\n" +printf "%b\n" " ${CLR_BOLD}[3]${CLR_RESET} ${CLR_YELLOW}Überspringen / Basiskonfiguration beibehalten${CLR_RESET}" +printf "%b\n" " Keine Änderungen vornehmen (kann später manuell eingerichtet werden)." +printf "\n" +printf "%b\n" "${CLR_BOLD}${CLR_CYAN}------------------------------------------------------------------------------${CLR_RESET}" + +while true; do + read -r -p "Bitte wählen Sie eine Option [1-3] (Standard: 1): " choice || choice="1" + choice="$(echo "$choice" | xargs)" + [[ -z "$choice" ]] && choice="1" + + case "$choice" in + 1) + install_linuxbeginnings + break + ;; + 2) + clone_custom_repo + break + ;; + 3) + mark_as_prompted + printf "\n" + printf "%b\n" "${CLR_YELLOW}[INFO] Einrichtung übersprungen. Die Basiskonfiguration bleibt aktiv.${CLR_RESET}" + printf "%b\n" "Sie können dieses Menü jederzeit erneut aufrufen mit:" + printf "%b\n" " ${CLR_BOLD}~/.config/hypr/scripts/install-dots-prompt.sh --force${CLR_RESET}" + break + ;; + *) + printf "%b\n" "${CLR_RED}Ungültige Eingabe. Bitte 1, 2 oder 3 wählen.${CLR_RESET}" + ;; + esac +done diff --git a/lib/tui.sh b/lib/tui.sh index afaa5b2..f454f06 100755 --- a/lib/tui.sh +++ b/lib/tui.sh @@ -35,7 +35,7 @@ tui_select_stages() { "06" "System-Dienste (AppArmor, Docker, Libvirt, zram)" ON \ "07" "Userland & Skel (Zsh, Skel-Templates, Dotfiles)" ON \ "08" "Flatpaks & Apps (Flathub, Flatpaks, MIME)" ON \ - "09" "Hyprland Desktop (LinuxBeginnings Installer)" ON \ + "09" "Hyprland Desktop (LinuxBeginnings Debian-Hyprland Installer)" ON \ 3>&1 1>&2 2>&3) || { log_info "Setup durch Benutzer abgebrochen." exit 0 diff --git a/lib/utils.sh b/lib/utils.sh index 199ce72..324e996 100755 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -118,8 +118,8 @@ prompt_target_user() { fi if [[ -n "$candidate" && "$candidate" != "root" ]]; then - printf "\n${CLR_CYAN}Target User Detection:${CLR_RESET}\n" > "$tty_out" - printf "Detected target user: ${CLR_BOLD}%s${CLR_RESET}\n" "$candidate" > "$tty_out" + printf "\n%bTarget User Detection:%b\n" "${CLR_CYAN}" "${CLR_RESET}" > "$tty_out" + printf "Detected target user: %b%s%b\n" "${CLR_BOLD}" "$candidate" "${CLR_RESET}" > "$tty_out" local answer="" read -r -p "Use target user '$candidate'? [Y/n]: " answer < "$tty_in" > "$tty_out" 2>&1 || answer="y" if [[ -z "$answer" || "$answer" =~ ^[YyJj] ]]; then @@ -132,15 +132,15 @@ prompt_target_user() { read -r -p "Please enter the target desktop username: " input_user < "$tty_in" > "$tty_out" 2>&1 || true input_user="$(echo "$input_user" | tr -d '[:space:]')" if [[ -z "$input_user" ]]; then - printf "${CLR_YELLOW}Username cannot be empty.${CLR_RESET}\n" > "$tty_out" + printf "%bUsername cannot be empty.%b\n" "${CLR_YELLOW}" "${CLR_RESET}" > "$tty_out" continue fi if [[ "$input_user" == "root" ]]; then - printf "${CLR_YELLOW}Root cannot be used as target desktop user.${CLR_RESET}\n" > "$tty_out" + printf "%bRoot cannot be used as target desktop user.%b\n" "${CLR_YELLOW}" "${CLR_RESET}" > "$tty_out" continue fi if ! id "$input_user" >/dev/null 2>&1; then - printf "${CLR_YELLOW}User '%s' does not exist on this system.${CLR_RESET}\n" "$input_user" > "$tty_out" + printf "%bUser '%s' does not exist on this system.%b\n" "${CLR_YELLOW}" "$input_user" "${CLR_RESET}" > "$tty_out" continue fi chosen="$input_user" diff --git a/stages/07-skel-and-user.sh b/stages/07-skel-and-user.sh index 3f8782a..4dd2b2a 100755 --- a/stages/07-skel-and-user.sh +++ b/stages/07-skel-and-user.sh @@ -44,11 +44,18 @@ fi if [[ -f "$SCRIPT_DIR/data/skel/.zshrc" ]]; then cp "$SCRIPT_DIR/data/skel/.zshrc" /etc/skel/.zshrc fi +if [[ -d "$SCRIPT_DIR/data/skel/.config" ]]; then + mkdir -p /etc/skel/.config + cp -r "$SCRIPT_DIR"/data/skel/.config/* /etc/skel/.config/ 2>/dev/null || true + if [[ -d /etc/skel/.config/hypr/scripts ]]; then + chmod 0755 /etc/skel/.config/hypr/scripts/*.sh 2>/dev/null || true + fi +fi chown -R root:root /etc/skel # 3. Synchronize User Environment for Target User log_substep "Synchronizing Dotfiles & Templates into $TARGET_HOME..." -mkdir -p "$TARGET_HOME/Templates" +mkdir -p "$TARGET_HOME/Templates" "$TARGET_HOME/.config" # Backup existing .zshrc if present if [[ -f "$TARGET_HOME/.zshrc" ]]; then @@ -63,6 +70,18 @@ if [[ -d "$SCRIPT_DIR/data/skel/Templates" ]]; then cp -r "$SCRIPT_DIR"/data/skel/Templates/* "$TARGET_HOME/Templates/" 2>/dev/null || true fi +# Backup existing Hyprland config if present +if [[ -f "$TARGET_HOME/.config/hypr/hyprland.conf" ]]; then + backup_file_or_dir "$TARGET_HOME/.config/hypr/hyprland.conf" +fi + +if [[ -d "$SCRIPT_DIR/data/skel/.config" ]]; then + cp -r "$SCRIPT_DIR"/data/skel/.config/* "$TARGET_HOME/.config/" 2>/dev/null || true + if [[ -d "$TARGET_HOME/.config/hypr/scripts" ]]; then + chmod 0755 "$TARGET_HOME"/.config/hypr/scripts/*.sh 2>/dev/null || true + fi +fi + # 4. Install Oh-My-Zsh for Target User (if not already installed) if [[ ! -d "$TARGET_HOME/.oh-my-zsh" ]]; then log_substep "Installing Oh-My-Zsh repository for $TARGET_USER..." @@ -72,7 +91,7 @@ if [[ ! -d "$TARGET_HOME/.oh-my-zsh" ]]; then fi # Fix ownership -chown -R "$TARGET_USER:$TARGET_USER" "$TARGET_HOME/.zshrc" "$TARGET_HOME/Templates" +chown -R "$TARGET_USER:$TARGET_USER" "$TARGET_HOME/.zshrc" "$TARGET_HOME/Templates" "$TARGET_HOME/.config" if [[ -d "$TARGET_HOME/.oh-my-zsh" ]]; then chown -R "$TARGET_USER:$TARGET_USER" "$TARGET_HOME/.oh-my-zsh" fi diff --git a/stages/08-flatpaks-apps.sh b/stages/08-flatpaks-apps.sh index 12d7759..2326137 100755 --- a/stages/08-flatpaks-apps.sh +++ b/stages/08-flatpaks-apps.sh @@ -16,7 +16,6 @@ log_step "Running Stage 08: Flatpaks, Additional Apps & MIME Associations" require_root TARGET_USER="$(get_target_user)" -TARGET_HOME="$(get_target_home)" # 1. Flathub Repository Setup log_substep "Configuring Flathub remote repository..." diff --git a/stages/09-hyprland.sh b/stages/09-hyprland.sh index 8191b86..3e47253 100644 --- a/stages/09-hyprland.sh +++ b/stages/09-hyprland.sh @@ -6,11 +6,12 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +# shellcheck source=lib/utils.sh source "$SCRIPT_DIR/lib/utils.sh" setup_err_trap -log_step "Running Stage 09: Hyprland Desktop (LinuxBeginnings Installer)" +log_step "Running Stage 09: Hyprland Desktop (LinuxBeginnings Debian-Hyprland Installer)" require_root @@ -19,24 +20,52 @@ TARGET_HOME="$(get_target_home)" log_info "Configuring Hyprland Desktop for target user: $TARGET_USER ($TARGET_HOME)" +# 1. Execute LinuxBeginnings Debian-Hyprland installer log_substep "Downloading and executing LinuxBeginnings Debian-Hyprland installer..." -INSTALLER_URL="https://raw.githubusercontent.com/LinuxBeginnings/Debian-Hyprland/main/auto-install.sh" -TEMP_INSTALLER="$(mktemp "/tmp/hyprland-install.XXXXXX.sh")" - -if curl -fsSL "$INSTALLER_URL" -o "$TEMP_INSTALLER"; then - chmod +x "$TEMP_INSTALLER" - chown "$TARGET_USER:$TARGET_USER" "$TEMP_INSTALLER" - - log_info "Running LinuxBeginnings auto-installer under user '$TARGET_USER'..." - if run_as_target_user bash "$TEMP_INSTALLER"; then +if command_exists curl; then + log_info "Running Debian-Hyprland installer as target user '$TARGET_USER'..." + if run_as_target_user bash -c 'sh <(curl -L https://raw.githubusercontent.com/LinuxBeginnings/Debian-Hyprland/main/auto-install.sh)'; then log_success "LinuxBeginnings Debian-Hyprland installation completed successfully." else log_warn "LinuxBeginnings installer exited with non-zero status. Check logs if needed." fi - rm -f "$TEMP_INSTALLER" else - log_error "Failed to download LinuxBeginnings Debian-Hyprland installer from $INSTALLER_URL" + log_error "curl is required to download Debian-Hyprland installer." exit 1 fi -log_success "Stage 09: Hyprland Desktop installation completed successfully!" +# 2. Ensure rudimentary Hyprland config is deployed to /etc/skel +log_substep "Deploying rudimentary Hyprland configuration to /etc/skel..." +mkdir -p /etc/skel/.config/hypr/scripts +if [[ -f "$SCRIPT_DIR/data/skel/.config/hypr/hyprland.conf" ]]; then + cp "$SCRIPT_DIR/data/skel/.config/hypr/hyprland.conf" /etc/skel/.config/hypr/hyprland.conf +fi +if [[ -f "$SCRIPT_DIR/data/skel/.config/hypr/scripts/install-dots-prompt.sh" ]]; then + cp "$SCRIPT_DIR/data/skel/.config/hypr/scripts/install-dots-prompt.sh" /etc/skel/.config/hypr/scripts/install-dots-prompt.sh + chmod 0755 /etc/skel/.config/hypr/scripts/install-dots-prompt.sh +fi +chown -R root:root /etc/skel/.config + +# 3. Deploy rudimentary Hyprland config to target user +log_substep "Deploying rudimentary Hyprland configuration to $TARGET_HOME/.config/hypr..." +mkdir -p "$TARGET_HOME/.config/hypr/scripts" + +if [[ -f "$TARGET_HOME/.config/hypr/hyprland.conf" ]]; then + backup_file_or_dir "$TARGET_HOME/.config/hypr/hyprland.conf" +fi + +if [[ -f "$SCRIPT_DIR/data/skel/.config/hypr/hyprland.conf" ]]; then + cp "$SCRIPT_DIR/data/skel/.config/hypr/hyprland.conf" "$TARGET_HOME/.config/hypr/hyprland.conf" +fi +if [[ -f "$SCRIPT_DIR/data/skel/.config/hypr/scripts/install-dots-prompt.sh" ]]; then + cp "$SCRIPT_DIR/data/skel/.config/hypr/scripts/install-dots-prompt.sh" "$TARGET_HOME/.config/hypr/scripts/install-dots-prompt.sh" + chmod 0755 "$TARGET_HOME/.config/hypr/scripts/install-dots-prompt.sh" +fi + +chown -R "$TARGET_USER:$TARGET_USER" "$TARGET_HOME/.config/hypr" + +log_success "Rudimentary Hyprland configuration deployed:" +log_info " - SUPER+ENTER: Kitty Terminal" +log_info " - SUPER+Q: Close Active Window" +log_info " - Login Prompt: Asks user after login to choose Dotfiles setup (LinuxBeginnings or custom Git repo for ~/.config)" +log_success "Stage 09: Hyprland Desktop installation & configuration completed successfully!"