Closed ghost closed 1 month ago
cp $HOME/monaspace/fonts/otf/* $HOME/.local/share/fonts/monaspace
This only works if you've cloned the repo to your home directory, though. We should just invoke the script from the root of the repo folder and not assume we know where it is located.
Okay, so in the following way, we avoid this problem.
Again, we use mkdir -p
and cp -u
, we also indicate correctly with a double dot ../
which folder we want to copy. In short, this would be the solution.
Using cp -u
you would not need to remove any previous fonts, this order allows copy the file only if it is newer than the destination.
#!/bin/bash
# if the folder does not exist, create the folder
mkdir -p $HOME/.local/share/fonts/monaspace
# copy all fonts from ../otf to ~/.local/share/fonts
cp -u ../fonts/otf/* $HOME/.local/share/fonts/monaspace
# copy variable fonts from ../variable to ~/.local/share/fonts
cp -u ../fonts/variable/* $HOME/.local/share/fonts/monaspace
# Build font information caches
fc-cache -f
Alternatively, we can leave the cp
commands to continue using the same paths as they do now and update the README.md
file to use the correct path instead:
Current instructions for linux:
cd util
bash ./install_linux.sh
Update to:
bash util/install_linux.sh
Still need to add a command to add the destination directory if it doesn't exist as noted in the previous comments.
Fixed in the batch of commits around 93c4bcdb772fe34c4aef415a87e1521ae9947012. Thank you!
The
util/install_linux.sh
script is badly written and does not work properly. Here is the fixed script:Changes
fonts
does not exist, create the folder inside$HOME/.local/share/
monaspace
to keep the files there, keeping thefonts
folder cleaner.cp: cannot stat
error$HOME
to make it easier for the user to read the script.Particularities
We assume that the script is executed from the home folder of your system. Otherwise, the script will fail. The script expects the folder
monaspace
to be in your$HOME
folder.Observations
If you want, you can delete the follow command:
And use
cp -u
instead. If you want to copy the file only if it is newer than the destination, invoke the command with the-u
option, like this:And beyond
A script could be written to download and install automatically with a single .sh file.
¡Un saludo!