download-selected-google-fonts (#9)

Reviewed-on: lxcafe/lxcafe#9
This commit is contained in:
2026-03-15 10:57:44 +01:00
parent b9693a455a
commit fb40815e6c
2 changed files with 33 additions and 40 deletions
@@ -31,9 +31,7 @@ echo "
# Das Skript bietet -teilweise interaktiv- die Installation von zusätzlichen Programmen an, die Linux Mint XFCE nicht standardmässig mitbringt. # Das Skript bietet -teilweise interaktiv- die Installation von zusätzlichen Programmen an, die Linux Mint XFCE nicht standardmässig mitbringt.
# #
# Folgende Dateien werden aus dem Skript referenziert und werden im selben Verzeichnis wie dieses Skript erwartet # Folgende Dateien werden aus dem Skript referenziert und werden im selben Verzeichnis wie dieses Skript erwartet
## - Microsoft Aptos Fonts.zip ## - xfce4-panel-profiles.tar.bz2
## - google-fonts.tar.gz
## - xfce4-panel.xml
# #
# Zu Beginn werden die folgenden zusätzlichen Programme in einem Schritt installiert: # Zu Beginn werden die folgenden zusätzlichen Programme in einem Schritt installiert:
# #
@@ -115,64 +113,58 @@ if question_answered_with_yes " ### Installiere Aptos Schriften? ###"; then
echo echo
echo "### Aptos Schriften ###" echo "### Aptos Schriften ###"
_aptos_zip="Microsoft Aptos Fonts.zip" _aptos_zip="/tmp/Microsoft Aptos Fonts.zip"
_aptos_url="https://download.microsoft.com/download/8/6/0/860a94fa-7feb-44ef-ac79-c072d9113d69/Microsoft%20Aptos%20Fonts.zip" _aptos_url="https://download.microsoft.com/download/8/6/0/860a94fa-7feb-44ef-ac79-c072d9113d69/Microsoft%20Aptos%20Fonts.zip"
echo "Lade Aptos Schriften herunter..." echo "Lade Aptos Schriften herunter..."
wget "$_aptos_url" -O "$_aptos_zip" wget "$_aptos_url" -O "$_aptos_zip"
echo "Entpacke das Archiv..." echo "Entpacke das Archiv..."
unzip -o "$_aptos_zip" unzip -o "$_aptos_zip" -d /tmp/aptos_fonts
echo "Erstelle /usr/share/fonts/truetype/aptos/" echo "Erstelle /usr/share/fonts/truetype/aptos/"
sudo mkdir -p /usr/share/fonts/truetype/aptos sudo mkdir -p /usr/share/fonts/truetype/aptos
echo "Installiere alle .ttf Schriften..." echo "Installiere alle .ttf Schriften..."
find . -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/aptos/ \; 2>/dev/null || true find /tmp/aptos_fonts -name "*.ttf" -exec sudo install -m644 {} /usr/share/fonts/truetype/aptos/ \; 2>/dev/null || true
echo "Aktualisiere den Font-Cache" echo "Aktualisiere den Font-Cache"
fc-cache -f fc-cache -f
echo "Fertig! Aptos Schriftarten sind installiert." echo "Fertig! Aptos Schriftarten sind installiert."
echo "Entferne temporäre Dateien..." echo "Entferne temporäre Dateien..."
rm -f "$_aptos_zip" rm -rf "$_aptos_zip" /tmp/aptos_fonts
fi fi
echo echo
echo echo
echo " ## freie Google-Schriften als Ersatz für aktuelle MS-Standardschriften installieren:" echo " ## freie Google-Schriften"
if question_answered_with_yes " ### Installiere Google Schriften? ###"; then if question_answered_with_yes " ### Installiere Google Schriften? ###"; then
echo echo
echo "### Google Schriften ###" echo "### Google Schriften ###"
_gf="google-fonts" _google_fonts_dir="/usr/share/fonts/truetype/google-fonts"
fGoogleSchriften=./$_gf".tar.gz" _google_fonts_url_base="https://gwfh.mranftl.com/api/fonts"
if [ ! -f "$fGoogleSchriften" ]; then
echo ""
echo "$fGoogleSchriften nicht gefunden."
echo " soll das Archiv "google-fonts.tar.gz" von Github heruntergeladen werden? Es ist ca. 1,4GB gross! "
if question_answered_with_yes " ### Download Google Schriften ###"; 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 "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" _google_fonts="arimo carlito caladea inconsolata cousine libre-franklin neuton cabin oswald crimson-text lustria tinos league-spartan pt-sans"
rm -r fonts-main
echo "Google-Schriften sind installiert. Die Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office muss manuell erfolgen, falls gewünscht." sudo mkdir -p "$_google_fonts_dir"
for _font in $_google_fonts; do
echo "Lade $_font herunter..."
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/* "$_google_fonts_dir/" 2>/dev/null || true
rm -rf /tmp/"$_font".zip /tmp/"$_font"_fonts
else else
echo "Schriften Fehlen immer noch. Manuell herunterladen und installieren" echo "Fehler: Download von $_font fehlgeschlagen, überspringe..."
rm -f /tmp/"$_font".zip
fi fi
done
echo "Aktualisiere den Font-Cache"
fc-cache -f
echo "Fertig! Google Schriftarten sind installiert."
echo "Die Anpassung der Standardschriften und/oder das Erstellen der Ersetzungstabelle in Libre Office muss manuell erfolgen, falls gewünscht."
fi fi
# #
+2 -1
View File
@@ -6,7 +6,8 @@ This directory contains files belonging to the Linux Mint XFCE post-installation
- Linux Mint XFCE installed and running - Linux Mint XFCE installed and running
- Internet connection for downloading packages and updates - Internet connection for downloading packages and updates
- Script file: `Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh` copied to Desktop - Script file: `Nachinstallationsarbeiten_LC_Esslingen_XFCE.sh` copied to Desktop
- External files are referenced by the script, please check header comments in the script
No external files need to be pre-downloaded.
## Usage ## Usage