Skip to content

Commit db983d3

Browse files
Merge pull request #75 from RazoBeckett:main
Fix POSIX Compatibility issue '[[' and Refactor Font installations step.
2 parents 0d8b971 + 426d143 commit db983d3

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

setup.sh

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,30 +131,36 @@ installDepend() {
131131
${SUDO_CMD} ${PACKAGER} -v ${DEPENDENCIES}
132132
elif [ "$PACKAGER" = "nix-env" ]; then
133133
${SUDO_CMD} ${PACKAGER} -iA nixos.bash nixos.bash-completion nixos.gnutar nixos.neovim nixos.bat nixos.tree nixos.multitail nixos.fastfetch nixos.pkgs.starship
134-
elif [[ "$PACKAGER" == "dnf" ]]; then
134+
elif [ "$PACKAGER" = "dnf" ]; then
135135
${SUDO_CMD} ${PACKAGER} install -y ${DEPENDENCIES}
136136
else
137137
${SUDO_CMD} ${PACKAGER} install -yq ${DEPENDENCIES}
138138
fi
139139

140-
# Check to see if the FiraCode Nerd Font is installed (Change this to whatever font you would like)
141-
FONT_NAME="FiraCode Nerd Font"
140+
# Check to see if the MesloLGS Nerd Font is installed (Change this to whatever font you would like)
141+
FONT_NAME="MesloLGS Nerd Font Mono"
142142
if fc-list :family | grep -iq "$FONT_NAME"; then
143143
echo "Font '$FONT_NAME' is installed."
144144
else
145145
echo "Installing font '$FONT_NAME'"
146146
# Change this URL to correspond with the correct font
147-
FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/v2.3.3/FiraCode.zip"
147+
FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip"
148148
FONT_DIR="$HOME/.local/share/fonts"
149-
wget $FONT_URL -O ${FONT_NAME}.zip
150-
unzip ${FONT_NAME}.zip -d $FONT_NAME
151-
mkdir -p $FONT_DIR
152-
mv ${FONT_NAME}/*.ttf $FONT_DIR/
153-
# Update the font cache
154-
fc-cache -fv
155-
# delete the files created from this
156-
rm -rf ${FONT_NAME} ${FONT_NAME}.zip
157-
echo "'$FONT_NAME' installed successfully."
149+
# check if the file is accessible
150+
if wget -q --spider "$FONT_URL"; then
151+
TEMP_DIR=$(mktemp -d)
152+
wget -q --show-progress $FONT_URL -O "$TEMP_DIR"/"${FONT_NAME}".zip
153+
unzip "$TEMP_DIR"/"${FONT_NAME}".zip -d "$TEMP_DIR"
154+
mkdir -p "$FONT_DIR"/"$FONT_NAME"
155+
mv "${TEMP_DIR}"/*.ttf "$FONT_DIR"/"$FONT_NAME"
156+
# Update the font cache
157+
fc-cache -fv
158+
# delete the files created from this
159+
rm -rf "${TEMP_DIR}"
160+
echo "'$FONT_NAME' installed successfully."
161+
else
162+
echo "Font '$FONT_NAME' not installed. Font URL is not accessible."
163+
fi
158164
fi
159165
}
160166

0 commit comments

Comments
 (0)