Update exit code and cleanup error messages
Change exit code from 0 to 1 on abort and simplify error messages in choose_list function.
This commit is contained in:
@@ -29,7 +29,7 @@ Möchtest du den Setup‑Assistenten wirklich abbrechen?" \
|
|||||||
|
|
||||||
rm -f "$HOME/.config/firstboot/run"
|
rm -f "$HOME/.config/firstboot/run"
|
||||||
systemctl --user disable firstboot-setup.service >/dev/null 2>&1 || true
|
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() {
|
cleanup() {
|
||||||
local code=$?
|
local code=$?
|
||||||
if [[ $code -ne 0 ]]; then
|
if [[ $code -ne 0 ]]; then
|
||||||
echo "Wizard mit Fehler beendet (Exitcode: $code)."
|
|
||||||
rm -f "$HOME/.config/firstboot/run"
|
rm -f "$HOME/.config/firstboot/run"
|
||||||
systemctl --user disable firstboot-setup.service >/dev/null 2>&1 || true
|
systemctl --user disable firstboot-setup.service >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
@@ -86,7 +85,7 @@ choose_list() {
|
|||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
if (( $# % 2 != 0 )); then
|
if (( $# % 2 != 0 )); then
|
||||||
echo "choose_list: Ungerade Anzahl Argumente (id/beschreibung Paare erwartet)." >&2
|
echo "choose_list: Ungerade Anzahl Argumente." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -96,8 +95,7 @@ choose_list() {
|
|||||||
shift 2
|
shift 2
|
||||||
done
|
done
|
||||||
|
|
||||||
local result
|
zenity --list \
|
||||||
result=$(zenity --list \
|
|
||||||
--title="$title" \
|
--title="$title" \
|
||||||
--text="$text" \
|
--text="$text" \
|
||||||
--checklist \
|
--checklist \
|
||||||
@@ -106,9 +104,7 @@ choose_list() {
|
|||||||
--column="Beschreibung" \
|
--column="Beschreibung" \
|
||||||
--separator="|" \
|
--separator="|" \
|
||||||
"${rows[@]}" \
|
"${rows[@]}" \
|
||||||
) || abort
|
|| abort
|
||||||
|
|
||||||
echo "${result:-}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -136,7 +132,7 @@ BROWSERS=$(choose_list \
|
|||||||
)
|
)
|
||||||
|
|
||||||
OFFICE=$(choose_list \
|
OFFICE=$(choose_list \
|
||||||
"Office & Dokumente" \
|
"Office & Dokumente" \
|
||||||
"<big><b>Office & Dokumente</b></big>\nAnwendungen für Büroarbeit und PDFs." \
|
"<big><b>Office & Dokumente</b></big>\nAnwendungen für Büroarbeit und PDFs." \
|
||||||
libreoffice "Umfangreiche Office‑Suite für lokale Dokumente" \
|
libreoffice "Umfangreiche Office‑Suite für lokale Dokumente" \
|
||||||
onlyoffice "Moderne Oberfläche, hohe MS‑Office‑Kompatibilität" \
|
onlyoffice "Moderne Oberfläche, hohe MS‑Office‑Kompatibilität" \
|
||||||
@@ -146,7 +142,7 @@ OFFICE=$(choose_list \
|
|||||||
)
|
)
|
||||||
|
|
||||||
GRAPHICS=$(choose_list \
|
GRAPHICS=$(choose_list \
|
||||||
"Grafik & Kreativ" \
|
"Grafik & Kreativ" \
|
||||||
"<big><b>Grafik & Kreativ</b></big>\nWerkzeuge für Bildbearbeitung und Illustration." \
|
"<big><b>Grafik & Kreativ</b></big>\nWerkzeuge für Bildbearbeitung und Illustration." \
|
||||||
gimp "Leistungsstarke Bildbearbeitung für Fotos" \
|
gimp "Leistungsstarke Bildbearbeitung für Fotos" \
|
||||||
krita "Digitale Malerei und Illustration" \
|
krita "Digitale Malerei und Illustration" \
|
||||||
@@ -154,7 +150,7 @@ GRAPHICS=$(choose_list \
|
|||||||
)
|
)
|
||||||
|
|
||||||
MEDIA=$(choose_list \
|
MEDIA=$(choose_list \
|
||||||
"Medien & Unterhaltung" \
|
"Medien & Unterhaltung" \
|
||||||
"<big><b>Medien & Unterhaltung</b></big>\nAudio‑ und Video‑Wiedergabe." \
|
"<big><b>Medien & Unterhaltung</b></big>\nAudio‑ und Video‑Wiedergabe." \
|
||||||
vlc "Spielt nahezu alle Audio‑ und Videoformate ab" \
|
vlc "Spielt nahezu alle Audio‑ und Videoformate ab" \
|
||||||
showtime "Einfacher Videoplayer mit klarer Oberfläche" \
|
showtime "Einfacher Videoplayer mit klarer Oberfläche" \
|
||||||
@@ -162,7 +158,7 @@ MEDIA=$(choose_list \
|
|||||||
)
|
)
|
||||||
|
|
||||||
AV=$(choose_list \
|
AV=$(choose_list \
|
||||||
"Audio & Video‑Bearbeitung" \
|
"Audio & Video‑Bearbeitung" \
|
||||||
"<big><b>Audio & Video‑Bearbeitung</b></big>\nWerkzeuge für kreative Medienproduktion." \
|
"<big><b>Audio & Video‑Bearbeitung</b></big>\nWerkzeuge für kreative Medienproduktion." \
|
||||||
shotcut "Einfacher Videoeditor für schnelle Projekte" \
|
shotcut "Einfacher Videoeditor für schnelle Projekte" \
|
||||||
kdenlive "Umfangreicher Videoeditor mit vielen Effekten" \
|
kdenlive "Umfangreicher Videoeditor mit vielen Effekten" \
|
||||||
@@ -197,52 +193,6 @@ SYSTEM=$(choose_list \
|
|||||||
flatseal "Verwaltung von Flatpak‑Berechtigungen" \
|
flatseal "Verwaltung von Flatpak‑Berechtigungen" \
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Homebrew
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
zenity --question \
|
|
||||||
--title="Homebrew (optional)" \
|
|
||||||
--text="<big><b>Homebrew installieren?</b></big>\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="<big><b>Automatische Updates aktivieren?</b></big>\n
|
|
||||||
Wöchentliche Prüfung und Installation von System‑Updates.\n
|
|
||||||
<b>Manuell:</b>\n
|
|
||||||
<tt>bootc upgrade</tt>" \
|
|
||||||
|| 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="<big><b>Bitte bestätige die Installation</b></big>\n\n$SUMMARY" \
|
|
||||||
|| abort
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Installation
|
# Installation
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -317,8 +267,6 @@ ensure_flathub
|
|||||||
[[ "$s" == flatseal ]] && flatpak install -y flathub com.github.tchx84.Flatseal
|
[[ "$s" == flatseal ]] && flatpak install -y flathub com.github.tchx84.Flatseal
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ "$USE_BREW" == yes ]] && install_brew_and_setup_path
|
|
||||||
|
|
||||||
echo "100"; echo "# Fertig."
|
echo "100"; echo "# Fertig."
|
||||||
) | zenity --progress \
|
) | zenity --progress \
|
||||||
--title="Installation läuft" \
|
--title="Installation läuft" \
|
||||||
@@ -326,11 +274,6 @@ ensure_flathub
|
|||||||
--percentage=0 \
|
--percentage=0 \
|
||||||
--auto-close
|
--auto-close
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Auto‑Update aktivieren
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
[[ "$AUTO_UPDATE" == yes ]] && systemctl --user enable --now bootc-update.timer || true
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Wizard done
|
# Wizard done
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@@ -342,6 +285,4 @@ zenity --info \
|
|||||||
--title="Fertig" \
|
--title="Fertig" \
|
||||||
--text="<big><b>Die Einrichtung ist abgeschlossen.</b></big>\n
|
--text="<big><b>Die Einrichtung ist abgeschlossen.</b></big>\n
|
||||||
Weitere Anwendungen kannst du jederzeit über den COSMIC‑Shop installieren.\n
|
Weitere Anwendungen kannst du jederzeit über den COSMIC‑Shop installieren.\n
|
||||||
<b>Homebrew aktualisieren:</b>\n
|
|
||||||
<tt>brew update && brew upgrade</tt>\n
|
|
||||||
Der Setup‑Assistent wird nicht erneut gestartet."
|
Der Setup‑Assistent wird nicht erneut gestartet."
|
||||||
|
|||||||
Reference in New Issue
Block a user