diff --git a/README.md b/README.md index bf364b6..208db1c 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ You can manually drag the fonts from the `fonts/otf` or `fonts/variable` directo There is also a script that automates the deletion of all Monaspace fonts from `~/Library/Fonts` and then copies over the latest versions. Invoke it from the root of the repo like: ```bash -$ bash util/install_macos.sh +$ ./util/install_macos.sh ``` You can also use [homebrew](https://brew.sh/) as an alternative: @@ -99,7 +99,7 @@ You can manually drag the fonts from the `fonts/otf` and `fonts/variable` direct There is also a script which automates the deletion of all Monaspace fonts from `~/.local/share/fonts` and then copies over the latest versions. Invoke it from the root of the repo like: ```bash -$ bash util/install_linux.sh +$ ./util/install_linux.sh ``` ### Webfonts diff --git a/util/install_linux.sh b/util/install_linux.sh index b1ece38..2f8f773 100755 --- a/util/install_linux.sh +++ b/util/install_linux.sh @@ -1,18 +1,25 @@ -#!/bin/bash +#!/usr/bin/env bash + +set -euo pipefail + +origin=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) || exit + +input_dir="${origin}/../fonts" +fonts_dir="${HOME}/.local/share/fonts" # ensure that ~/.local/share/fonts exists -mkdir -p ~/.local/share/fonts +mkdir -p "${fonts_dir}" # remove all fonts from ~/.local/share/fonts that start with "Monaspace" -rm -rf ~/.local/share/fonts/Monaspace* +rm -rf "${fonts_dir}/"Monaspace* -mkdir -p ~/.local/share/fonts/Monaspace/ +mkdir -p "${fonts_dir}/Monaspace/" # copy all fonts from ./otf to ~/.local/share/fonts -cp ./fonts/otf/* ~/.local/share/fonts/Monaspace/ +cp "${input_dir}/otf/"* "${fonts_dir}/Monaspace/" # copy variable fonts from ./variable to ~/.local/share/fonts -cp ./fonts/variable/* ~/.local/share/fonts/Monaspace/ +cp "${input_dir}/variable/"* "${fonts_dir}/Monaspace/" # Build font information caches fc-cache -f diff --git a/util/install_macos.sh b/util/install_macos.sh index ea0cced..b45a58f 100755 --- a/util/install_macos.sh +++ b/util/install_macos.sh @@ -1,10 +1,17 @@ -#!/bin/bash +#!/usr/bin/env bash + +set -euo pipefail + +origin=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) || exit + +input_dir="${origin}/../fonts" +fonts_dir="${HOME}/Library/Fonts" # remove all fonts from ~/Library/Fonts that start with "Monaspace" -rm -rf ~/Library/Fonts/Monaspace* +rm -rf "${fonts_dir}"/Monaspace* # copy all fonts from ./otf to ~/Library/Fonts -cp ./fonts/otf/* ~/Library/Fonts +cp "${input_dir}/otf/"* "${fonts_dir}" # copy variable fonts from ./variable to ~/Library/Fonts -cp ./fonts/variable/* ~/Library/Fonts \ No newline at end of file +cp "${input_dir}/variable/"* "${fonts_dir}" \ No newline at end of file