mirror of
https://github.com/aquatix/dotfiles.git
synced 2025-12-07 00:05:10 +01:00
60 lines
1.9 KiB
Bash
Executable File
60 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function install_font {
|
|
if [ -e "$2" ] && [ ! -L "$2" ]; then
|
|
echo "Already exists as real file: $2"
|
|
elif [ -L "$2" ]; then
|
|
echo "Skipped: $2"
|
|
else
|
|
echo "Linked font: $2"
|
|
ln -s "$1" "$2"
|
|
fi
|
|
}
|
|
|
|
IFS=$'\n'
|
|
|
|
FONTS_SAUCECODE=$'Sauce Code Pro Bold Plus Nerd File Types Mono Plus Font Awesome Plus Octicons Plus Pomicons.ttf
|
|
Sauce Code Pro Medium Plus Nerd File Types Mono Plus Font Awesome Plus Octicons Plus Pomicons.ttf
|
|
Sauce Code Pro Medium Plus Nerd File Types Plus Font Awesome Plus Octicons Plus Pomicons.ttf'
|
|
FONTS_FUTURA=$'Futura-Std-Bold_19042.ttf
|
|
Futura-Std-Bold-Oblique_19041.ttf
|
|
Futura-Std-Book_19044.ttf
|
|
Futura-Std-Book-Oblique_19043.ttf'
|
|
|
|
if [ -e ~/.dot_is_server ]; then
|
|
# Update from the repo
|
|
SOURCE_DIR="/stuff/system/fonts/nerd-fonts/patched-fonts/SourceCodePro"
|
|
DEST_DIR="/stuff/system/sync/fonts/active"
|
|
if [ -d "$SOURCE_DIR" ] && [ -d "$DEST_DIR" ]; then
|
|
cd "$SOURCE_DIR"
|
|
git pull --all
|
|
while read -r FONT; do
|
|
echo "Copied font: $FONT"
|
|
cp -a "$SOURCE_DIR/$FONT" "$DEST_DIR"
|
|
done <<< "$FONTS_SAUCECODE"
|
|
else
|
|
echo "$SOURCE_DIR or $DEST_DIR not found, aborting"
|
|
fi
|
|
else
|
|
# Create symlinks if needed
|
|
SOURCE_DIR="$HOME/Downloads/sync/fonts/active"
|
|
DEST_DIR="$HOME/.local/share/fonts"
|
|
if [ ! -e "$DEST_DIR" ]; then
|
|
mkdir -p "$DEST_DIR"
|
|
fi
|
|
if [ -d "$SOURCE_DIR" ]; then
|
|
cd "$DEST_DIR"
|
|
while read -r FONT; do
|
|
install_font "$SOURCE_DIR/$FONT" "$DEST_DIR/$FONT"
|
|
done <<< "$FONTS_SAUCECODE"
|
|
while read -r FONT; do
|
|
install_font "$SOURCE_DIR/$FONT" "$DEST_DIR/$FONT"
|
|
done <<< "$FONTS_FUTURA"
|
|
else
|
|
echo "$SOURCE_DIR not found, aborting"
|
|
fi
|
|
if [ -d "$HOME/.fonts" ]; then
|
|
echo "Mind that you do have a ~/.fonts dir too, which might contain older versions"
|
|
fi
|
|
fi
|