seperate function question_answered_with_yes from /post_installation_script/Nachinstallationsarbeiten_LC_Esslingen.sh

This commit is contained in:
knightsub9
2026-06-30 15:52:44 +02:00
parent cf5de8f44e
commit 4fcfcbe06b
2 changed files with 154 additions and 152 deletions
@@ -2,18 +2,6 @@
SCRIPT_VERSION="v11"
question_answered_with_yes() {
local prompt="$1"
local ans
printf '%b\n Geben Sie j oder n ein und die Eingabetaste,\n Abbruch mit jeder anderen Taste ... [j/N]: ' "$prompt"
read -r ans
case "$ans" in
j|J|ja|y|Y) return 0 ;;
n|N|"") return 1 ;;
*) echo "Abbruch."; exit 1 ;;
esac
}
echo "
#####################################
#### Nachinstallationsarbeiten
@@ -80,7 +68,10 @@ if [ -z "$DETECTED_DESKTOP" ]; then
case "$desktop_choice" in
1) DESKTOP="xfce" ;;
2) DESKTOP="cinnamon" ;;
*) echo "Ungültige Auswahl. Skript wird beendet."; exit 1 ;;
*)
echo "Ungültige Auswahl. Skript wird beendet."
exit 1
;;
esac
else
echo
@@ -99,7 +90,10 @@ else
case "$desktop_choice" in
1) DESKTOP="xfce" ;;
2) DESKTOP="cinnamon" ;;
*) echo "Ungültige Auswahl. Skript wird beendet."; exit 1 ;;
*)
echo "Ungültige Auswahl. Skript wird beendet."
exit 1
;;
esac
fi
fi
@@ -130,7 +124,6 @@ if question_answered_with_yes " ### Installiere Sensoren? ###"; then
fi
fi
echo
echo
echo "### Kauf-DVDs abspielen ###"
@@ -140,7 +133,6 @@ if question_answered_with_yes " ### Installiere Paket um Film DVDs abspielen zu
sudo dpkg-reconfigure libdvd-pkg
fi
echo
echo
echo "### Schriften, falls Microsoft-Office-Dokumente weiterverwendet werden sollen oder Dokumentenaustausch mit Microsoft-Nutzern gewünscht ist ###
@@ -197,7 +189,7 @@ if question_answered_with_yes " ### Installiere Google Schriften? ###"; then
curl -s -o /tmp/"$_font".zip "${_google_fonts_url_base}/$_font?download=zip&subsets=latin,latin-ext&variants=regular,700"
if [ -s /tmp/"$_font".zip ] && head -c 2 /tmp/"$_font".zip | grep -q "PK"; then
unzip -o /tmp/"$_font".zip -d /tmp/"$_font"_fonts
sudo cp /tmp/"$_font"_fonts/fonts/"$_font"/* "$_google_fonts_dir/" 2>/dev/null || \
sudo cp /tmp/"$_font"_fonts/fonts/"$_font"/* "$_google_fonts_dir/" 2>/dev/null ||
sudo cp /tmp/"$_font"_fonts/* "$_google_fonts_dir/" 2>/dev/null || true
rm -rf /tmp/"$_font".zip /tmp/"$_font"_fonts
else
@@ -212,8 +204,6 @@ if question_answered_with_yes " ### Installiere Google Schriften? ###"; then
echo "Die Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office muss manuell erfolgen, falls gewünscht."
fi
echo
echo
echo "#### Chromium Browser installieren:"
@@ -223,7 +213,6 @@ if question_answered_with_yes " ### Installiere Chromium? ###"; then
sudo apt install chromium
fi
echo
echo
echo "#### Vivaldi Browser installieren:"
@@ -245,7 +234,6 @@ if question_answered_with_yes " ### Installiere Vivaldi? ###"; then
#
fi
echo
echo
echo "####Signal für Desktop (die Nutzung setzt eine Signal-Installation auf einem Android- Oder Apple-Gerät voraus!)#### "
@@ -265,8 +253,6 @@ if question_answered_with_yes " ### Installiere Signal? ###"; then
#
fi
echo
echo "###############################"
echo "######### Skript ENDE #########"
+16
View File
@@ -0,0 +1,16 @@
# functions and variables for use in multiple files ("common" functions and variables)
question_answered_with_yes() {
local prompt="$1"
local ans
printf '%b\n Geben Sie j oder n ein und die Eingabetaste,\n Abbruch mit jeder anderen Taste ... [j/N]: ' "$prompt"
read -r ans
case "$ans" in
j | J | ja | y | Y) return 0 ;;
n | N | "") return 1 ;;
*)
echo "Abbruch."
exit 1
;;
esac
}