From 9cdf112bea04a9f42007a6fc790fc3b7600b62ff Mon Sep 17 00:00:00 2001 From: humocs-man <251756307+humocs-man@users.noreply.github.com> Date: Fri, 13 Mar 2026 13:34:41 +0100 Subject: [PATCH] Update exit code and cleanup error messages Change exit code from 0 to 1 on abort and simplify error messages in choose_list function. --- .../skel/.config/firstboot/firstboot-setup.sh | 75 ++----------------- 1 file changed, 8 insertions(+), 67 deletions(-) diff --git a/files/etc/skel/.config/firstboot/firstboot-setup.sh b/files/etc/skel/.config/firstboot/firstboot-setup.sh index dd5109d..8506df3 100644 --- a/files/etc/skel/.config/firstboot/firstboot-setup.sh +++ b/files/etc/skel/.config/firstboot/firstboot-setup.sh @@ -29,7 +29,7 @@ Möchtest du den Setup‑Assistenten wirklich abbrechen?" \ rm -f "$HOME/.config/firstboot/run" systemctl --user disable firstboot-setup.service >/dev/null 2>&1 || true - exit 0 + exit 1 } # ------------------------------------------------------------ @@ -38,7 +38,6 @@ Möchtest du den Setup‑Assistenten wirklich abbrechen?" \ cleanup() { local code=$? if [[ $code -ne 0 ]]; then - echo "Wizard mit Fehler beendet (Exitcode: $code)." rm -f "$HOME/.config/firstboot/run" systemctl --user disable firstboot-setup.service >/dev/null 2>&1 || true fi @@ -86,7 +85,7 @@ choose_list() { shift 2 if (( $# % 2 != 0 )); then - echo "choose_list: Ungerade Anzahl Argumente (id/beschreibung Paare erwartet)." >&2 + echo "choose_list: Ungerade Anzahl Argumente." >&2 exit 1 fi @@ -96,8 +95,7 @@ choose_list() { shift 2 done - local result - result=$(zenity --list \ + zenity --list \ --title="$title" \ --text="$text" \ --checklist \ @@ -106,9 +104,7 @@ choose_list() { --column="Beschreibung" \ --separator="|" \ "${rows[@]}" \ - ) || abort - - echo "${result:-}" + || abort } # ------------------------------------------------------------ @@ -136,7 +132,7 @@ BROWSERS=$(choose_list \ ) OFFICE=$(choose_list \ - "Office & Dokumente" \ + "Office & Dokumente" \ "Office & Dokumente\nAnwendungen für Büroarbeit und PDFs." \ libreoffice "Umfangreiche Office‑Suite für lokale Dokumente" \ onlyoffice "Moderne Oberfläche, hohe MS‑Office‑Kompatibilität" \ @@ -146,7 +142,7 @@ OFFICE=$(choose_list \ ) GRAPHICS=$(choose_list \ - "Grafik & Kreativ" \ + "Grafik & Kreativ" \ "Grafik & Kreativ\nWerkzeuge für Bildbearbeitung und Illustration." \ gimp "Leistungsstarke Bildbearbeitung für Fotos" \ krita "Digitale Malerei und Illustration" \ @@ -154,7 +150,7 @@ GRAPHICS=$(choose_list \ ) MEDIA=$(choose_list \ - "Medien & Unterhaltung" \ + "Medien & Unterhaltung" \ "Medien & Unterhaltung\nAudio‑ und Video‑Wiedergabe." \ vlc "Spielt nahezu alle Audio‑ und Videoformate ab" \ showtime "Einfacher Videoplayer mit klarer Oberfläche" \ @@ -162,7 +158,7 @@ MEDIA=$(choose_list \ ) AV=$(choose_list \ - "Audio & Video‑Bearbeitung" \ + "Audio & Video‑Bearbeitung" \ "Audio & Video‑Bearbeitung\nWerkzeuge für kreative Medienproduktion." \ shotcut "Einfacher Videoeditor für schnelle Projekte" \ kdenlive "Umfangreicher Videoeditor mit vielen Effekten" \ @@ -197,52 +193,6 @@ SYSTEM=$(choose_list \ flatseal "Verwaltung von Flatpak‑Berechtigungen" \ ) -# ------------------------------------------------------------ -# Homebrew -# ------------------------------------------------------------ -zenity --question \ - --title="Homebrew (optional)" \ - --text="Homebrew installieren?\n -Zusätzlicher Paketmanager für Entwickler‑ und CLI‑Werkzeuge.\n -• Installation im Benutzerverzeichnis\n -• Keine Änderung am Basissystem\n -• Komplett optional" \ - || true -USE_BREW=$([[ $? -eq 0 ]] && echo yes || echo no) - -# ------------------------------------------------------------ -# Auto‑Update -# ------------------------------------------------------------ -zenity --question \ - --title="Automatische Systemaktualisierung" \ - --text="Automatische Updates aktivieren?\n -Wöchentliche Prüfung und Installation von System‑Updates.\n -Manuell:\n -bootc upgrade" \ - || true -AUTO_UPDATE=$([[ $? -eq 0 ]] && echo yes || echo no) - -# ------------------------------------------------------------ -# Zusammenfassung -# ------------------------------------------------------------ -SUMMARY="Browser: ${BROWSERS:-keine} -Office: ${OFFICE:-keine} -Grafik: ${GRAPHICS:-keine} -Medien: ${MEDIA:-keine} -Audio/Video: ${AV:-keine} -Spiele: ${GAMES:-keine} -E‑Mail: ${MAIL:-keine} -Entwicklung: ${DEV:-keine} -System: ${SYSTEM:-keine} - -Homebrew: $USE_BREW -Automatische Updates: $AUTO_UPDATE" - -zenity --question \ - --title="Zusammenfassung" \ - --text="Bitte bestätige die Installation\n\n$SUMMARY" \ - || abort - # ------------------------------------------------------------ # Installation # ------------------------------------------------------------ @@ -317,8 +267,6 @@ ensure_flathub [[ "$s" == flatseal ]] && flatpak install -y flathub com.github.tchx84.Flatseal done - [[ "$USE_BREW" == yes ]] && install_brew_and_setup_path - echo "100"; echo "# Fertig." ) | zenity --progress \ --title="Installation läuft" \ @@ -326,11 +274,6 @@ ensure_flathub --percentage=0 \ --auto-close -# ------------------------------------------------------------ -# Auto‑Update aktivieren -# ------------------------------------------------------------ -[[ "$AUTO_UPDATE" == yes ]] && systemctl --user enable --now bootc-update.timer || true - # ------------------------------------------------------------ # Wizard done # ------------------------------------------------------------ @@ -342,6 +285,4 @@ zenity --info \ --title="Fertig" \ --text="Die Einrichtung ist abgeschlossen.\n Weitere Anwendungen kannst du jederzeit über den COSMIC‑Shop installieren.\n -Homebrew aktualisieren:\n -brew update && brew upgrade\n Der Setup‑Assistent wird nicht erneut gestartet."