diff --git a/20251212_Nachinstallationsarbeiten_LC_Esslingen_XFCE_v8.sh b/20251212_Nachinstallationsarbeiten_LC_Esslingen_XFCE_v8.sh index e50c371..14ff8cc 100644 --- a/20251212_Nachinstallationsarbeiten_LC_Esslingen_XFCE_v8.sh +++ b/20251212_Nachinstallationsarbeiten_LC_Esslingen_XFCE_v8.sh @@ -10,6 +10,18 @@ bIsVlcInstalled=false +# Prompt helper: ask a question and return 0 (yes) for j/J/ja/y/Y, non-zero otherwise +question_answered_with_yes() { + local prompt="$1" + local ans + # -r prevents backslash escapes being interpreted; -p prints the prompt + read -rp "$prompt [j/N]: " ans + case "$ans" in + j|J|ja|y|Y) return 0 ;; + *) return 1 ;; + esac +} + echo " ################################### @@ -45,13 +57,10 @@ sSuffixDate=$(date '+%Y-%m-%d_%H:%M:%S') echo -read -p "#### 64 bit Mint XFCE ; Zusatzprogramme #### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "#### 64 bit Mint XFCE ####" - sudo apt -y install xfce4-goodies clementine vlc htop hardinfo font-manager asunder gtkhash xfce4-panel-profiles - bIsVlcInstalled=true +if question_answered_with_yes "#### 64 bit Mint XFCE ; Zusatzprogramme ####\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "#### 64 bit Mint XFCE ####" + sudo apt -y install xfce4-goodies clementine vlc htop hardinfo font-manager asunder gtkhash xfce4-panel-profiles + bIsVlcInstalled=true fi echo "" @@ -61,33 +70,27 @@ echo echo "#### nur auf Wunsch / bei Bedarf ####" echo ### Sensoren ### -read -p " ### Sensoren ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### Sensoren ###" - sudo apt install lm-sensors psensor - sudo sensors-detect - sudo service kmod start - echo "## im Anschluss "psensor" konfigurieren im XFCE-Applet in der Taskleiste" +if question_answered_with_yes " ### Sensoren ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### Sensoren ###" + sudo apt install lm-sensors psensor + sudo sensors-detect + sudo service kmod start + echo "## im Anschluss \"psensor\" konfigurieren im XFCE-Applet in der Taskleiste" fi echo echo -if $bIsVlcInstalled; then - echo "### Kauf-DVDs abspielen ###" - read -p " ### Film DVDs ### - Geben Sie j oder n ein und die Eingabetaste, - Abbruch mit jeder anderen Taste ... " kommando; - if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### Kauf-DVDs abspielen ###" - sudo apt install libdvd-pkg - sudo dpkg-reconfigure libdvd-pkg - fi +if [ "$bIsVlcInstalled" = true ]; then + echo "### Kauf-DVDs abspielen ###" + if question_answered_with_yes " ### Film DVDs ###\n\tGeben Sie j oder n ein und die Eingabetaste,\n\tAbbruch mit jeder anderen Taste ..."; then + echo "### Kauf-DVDs abspielen ###" + sudo apt install libdvd-pkg + sudo dpkg-reconfigure libdvd-pkg + fi else - echo "Player Fehlt - ## VLC muss installiert sein um Kauf-DVDs abspielen zu können" + echo "Player Fehlt + ## VLC muss installiert sein um Kauf-DVDs abspielen zu können" fi @@ -96,23 +99,17 @@ echo echo "### Schriften, falls Microsoft-Office-Dokumente weiterverwendet werden sollen oder Dokumentenaustausch mit Microsoft-Nutzern gewünscht ist ### ## frei verfügbare, alte Microsoft-Standardschriften installieren:" -read -p " ### M$ Schriften ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### M$ Schriften ###" - sudo apt install ttf-mscorefonts-installer +if question_answered_with_yes " ### M$ Schriften ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### M$ Schriften ###" + sudo apt install ttf-mscorefonts-installer fi echo echo echo " ## freie Google-Schriften als Ersatz für aktuelle MS-Standardschriften installieren:" -read -p " ### Google Schriften ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo - echo "### Google Schriften ###" +if question_answered_with_yes " ### Google Schriften ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo + echo "### Google Schriften ###" _gf="google-fonts" fGoogleSchriften=./$_gf".tar.gz" @@ -120,27 +117,23 @@ if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == ' echo "" echo "$fGoogleSchriften nicht gefunden." echo " soll das Archiv "google-fonts.tar.gz" von Github heruntergeladen werden? Es ist ca. 1,4GB gross! " - read -p " ### Download Google Schriften ### - Geben Sie j oder n ein und die Eingabetaste, - Abbruch mit jeder anderen Taste ... " runterLaden; - if [ $runterLaden == 'j' -o $runterLaden == 'J' -o $runterLaden == 'ja' -o $runterLaden == 'y' -o $runterLaden == 'Y' ]; then - _wgeturl="https://github.com/google/fonts/archive/main.tar.gz" - echo "Connecting to Github server to download fonts..." - wget $_wgeturl -O $_gf.tar.gz - fi + if question_answered_with_yes " ### Download Google Schriften ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + _wgeturl="https://github.com/google/fonts/archive/main.tar.gz" + echo "Connecting to Github server to download fonts..." + wget "$_wgeturl" -O "$_gf.tar.gz" + fi fi - if [ -f "$fGoogleSchriften" ]; then - echo - echo "$fGoogleSchriften nicht gefunden." - echo "Extracting the downloaded archive..." - tar -zxvf $_gf.tar.gz - echo "Creating the /usr/share/fonts/truetype/$_gf folder" - sudo mkdir -p /usr/share/fonts/truetype/$_gf - echo "Installing all .ttf fonts in /usr/share/fonts/truetype/$_gf" - find $PWD/fonts-main/ -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/google-fonts/ \; || echo "An error occured, please run this script again." - echo "Updating the font cache" - fc-cache -f - echo "Done. Now you can delete the tarball file $_gf.tar.gz if you wish." + if [ -f "$fGoogleSchriften" ]; then + echo + echo "Extracting the downloaded archive..." + tar -zxvf "$_gf.tar.gz" + echo "Creating the /usr/share/fonts/truetype/$_gf folder" + sudo mkdir -p /usr/share/fonts/truetype/$_gf + echo "Installing all .ttf fonts in /usr/share/fonts/truetype/$_gf" + find "$PWD/fonts-main/" -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/google-fonts/ \; || echo "An error occured, please run this script again." + echo "Updating the font cache" + fc-cache -f + echo "Done. Now you can delete the tarball file $_gf.tar.gz if you wish." echo "Temporärer Fontordner wird gelöscht" rm -r fonts-main @@ -158,26 +151,19 @@ fi echo echo echo "#### Chromium Browser installieren:" -read -p " ### Chromium ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### Chromium ###" - sudo apt install chromium-browser - sudo apt install chromium - fi88= +if question_answered_with_yes " ### Chromium ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### Chromium ###" + sudo apt install chromium-browser + sudo apt install chromium fi echo echo echo "#### Vivaldi Browser installieren:" -read -p " ### Vivaldi ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### ###" - echo "## nötige Zusatzpakete installieren" - sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y +if question_answered_with_yes " ### Vivaldi ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### ###" + echo "## nötige Zusatzpakete installieren" + sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y # echo "## ## key importieren" curl -fsSL https://repo.vivaldi.com/archive/linux_signing_key.pub | gpg --dearmor | sudo tee /usr/share/keyrings/vivaldi.gpg > /dev/null @@ -197,16 +183,13 @@ fi echo echo echo "####Signal für Desktop (die Nutzung setzt eine Signal-Installation auf einem Android- Oder Apple-Gerät voraus!)#### " -read -p " ### Signal ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### ###" - echo "## zusätzliches Repository nötig! - ## NOTE: These instructions only work for 64-bit Debian-based - ## Linux distributions such as Ubuntu, Mint etc. - ## key importieren - " +if question_answered_with_yes " ### Signal ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### ###" + echo "## zusätzliches Repository nötig! + ## NOTE: These instructions only work for 64-bit Debian-based + ## Linux distributions such as Ubuntu, Mint etc. + ## key importieren + " wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg cat signal-desktop-keyring.gpg | sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null # @@ -227,13 +210,10 @@ echo echo "Achtung! Es kann vorkommen, dass die Taskleiste nach diesem Schritt verschwunden ist." echo "Ein Abmelden und Wiederanmelden des Benutzers oder ein Reboot behebt das Problem." echo -read -p " ### Panel ### -Geben Sie j oder n ein und die Eingabetaste, -Abbruch mit jeder anderen Taste ... " kommando; -if [ $kommando == 'j' -o $kommando == 'J' -o $kommando == 'ja' -o $kommando == 'y' -o $kommando == 'Y' ]; then - echo "### ###" - echo "## Austausch der Panel-Konfigurationsdatei:" - xfce4-panel-profiles load current-config.tar.bz2 +if question_answered_with_yes " ### Panel ###\nGeben Sie j oder n ein und die Eingabetaste,\nAbbruch mit jeder anderen Taste ..."; then + echo "### ###" + echo "## Austausch der Panel-Konfigurationsdatei:" + xfce4-panel-profiles load current-config.tar.bz2 fi echo echo "###############################" @@ -251,6 +231,6 @@ echo echo "Wenn ### Google-Schriften ### installiert wurden: Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office, falls gewünscht." echo echo -read -p " ### Um dieses Fenster zu schliessen, "Enter" drücken ### " kommando; -if [ $kommando == 'j' -o $kommando == 'J' ]; then - return +if question_answered_with_yes " ### Um dieses Fenster zu schliessen, \"Enter\" drücken ###"; then + exit 0 +fi