Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install scripts bash improvements #266

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down
19 changes: 13 additions & 6 deletions util/install_linux.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 11 additions & 4 deletions util/install_macos.sh
Original file line number Diff line number Diff line change
@@ -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
cp "${input_dir}/variable/"* "${fonts_dir}"