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

Fixed install_linux.sh #239

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 21 additions & 11 deletions util/install_linux.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
#!/bin/bash

# ensure that ~/.local/share/fonts exists
mkdir -p ~/.local/share/fonts
# Set the current user
USER=$(logname)
echo "Current user is $USER"

# remove all fonts from ~/.local/share/fonts that start with "Monaspace"
rm -rf ~/.local/share/fonts/Monaspace*
# Set the target font directory
TARGET_DIR="/home/$USER/.local/share/fonts/Monaspace"
Copy link

@opatry opatry Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be $HOME.

Suggested change
TARGET_DIR="/home/$USER/.local/share/fonts/Monaspace"
target_dir="$HOME/.local/share/fonts/Monaspace"

Also, uppercase variables are usually used for environment variables, not local script variables.


mkdir -p ~/.local/share/fonts/Monaspace/
# Create the ~/.local/share/fonts/ directory if it doesn't exist
mkdir -p "/home/$USER/.local/share/fonts"

# copy all fonts from ./otf to ~/.local/share/fonts
cp ./fonts/otf/* ~/.local/share/fonts/Monaspace/
# Remove the Monaspace directory if it exists
if [ -d "$TARGET_DIR" ]; then
rm -rf "$TARGET_DIR"
fi

# copy variable fonts from ./variable to ~/.local/share/fonts
cp ./fonts/variable/* ~/.local/share/fonts/Monaspace/
# Create the Monaspace directory
mkdir -p "$TARGET_DIR"

# Build font information caches
fc-cache -f
# Copy fonts from the local repository to the target directory
cp -r ./fonts/otf/* "$TARGET_DIR/"
cp -r ./fonts/variable/* "$TARGET_DIR/"

# Update the font cache
fc-cache -fv

echo "Fonts copied to $TARGET_DIR and font cache updated."