mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2025-01-25 03:32:02 +02:00
Added support to intall fonts to global system path.
Allows execution 'sudo ./install.sh -S <fonts>' which will use the global system install path rather than the users local path.
This commit is contained in:
parent
8284d59508
commit
ab687375f3
23
install.sh
23
install.sh
@ -11,12 +11,14 @@ windows=false
|
|||||||
extension="otf"
|
extension="otf"
|
||||||
patches=("Complete")
|
patches=("Complete")
|
||||||
compat=()
|
compat=()
|
||||||
|
installpath="user"
|
||||||
|
|
||||||
# Usage info
|
# Usage info
|
||||||
usage() {
|
usage() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: ./install.sh [-q -v -h] [[--copy | --link] --clean | --list]
|
Usage: ./install.sh [-q -v -h] [[--copy | --link] --clean | --list]
|
||||||
[--use-single-width-glyphs] [--windows] [--otf | --ttf]
|
[--use-single-width-glyphs] [--windows] [--otf | --ttf]
|
||||||
|
[--install-to-user-path | --install-to-system-path ]
|
||||||
[--complete | --minimal | <patches>] [FONT...]
|
[--complete | --minimal | <patches>] [FONT...]
|
||||||
|
|
||||||
General options:
|
General options:
|
||||||
@ -35,6 +37,9 @@ General options:
|
|||||||
-s, --use-single-width-glyphs Install single-width glyphs variants.
|
-s, --use-single-width-glyphs Install single-width glyphs variants.
|
||||||
-w, --windows Install with limited internal font names.
|
-w, --windows Install with limited internal font names.
|
||||||
|
|
||||||
|
-U, --install-to-user-path Install fonts to users home font path [default].
|
||||||
|
-S, --install-to-system-path Install fonts to global system path for all users, requires root.
|
||||||
|
|
||||||
-O, --otf Prefer OTF font files [default].
|
-O, --otf Prefer OTF font files [default].
|
||||||
-T, --ttf Prefer TTF font files.
|
-T, --ttf Prefer TTF font files.
|
||||||
|
|
||||||
@ -59,7 +64,7 @@ version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
optspec=":qvhclLCswOTAM-:"
|
optspec=":qvhclLCsSUwOTAM-:"
|
||||||
while getopts "$optspec" optchar; do
|
while getopts "$optspec" optchar; do
|
||||||
case "${optchar}" in
|
case "${optchar}" in
|
||||||
|
|
||||||
@ -77,6 +82,8 @@ while getopts "$optspec" optchar; do
|
|||||||
T) extension="ttf";;
|
T) extension="ttf";;
|
||||||
A) patches=("Complete");;
|
A) patches=("Complete");;
|
||||||
M) patches=();;
|
M) patches=();;
|
||||||
|
S) installpath="system";;
|
||||||
|
U) installpath="user";;
|
||||||
|
|
||||||
-)
|
-)
|
||||||
case "${OPTARG}" in
|
case "${OPTARG}" in
|
||||||
@ -94,6 +101,8 @@ while getopts "$optspec" optchar; do
|
|||||||
ttf) extension="ttf";;
|
ttf) extension="ttf";;
|
||||||
complete) patches=("Complete");;
|
complete) patches=("Complete");;
|
||||||
minimal) patches=();;
|
minimal) patches=();;
|
||||||
|
install-to-system-path) installpath="system";;
|
||||||
|
install-to-user-path) installpath="user";;
|
||||||
*)
|
*)
|
||||||
case "${OPTARG}" in
|
case "${OPTARG}" in
|
||||||
# Long options that define variations
|
# Long options that define variations
|
||||||
@ -231,10 +240,18 @@ done
|
|||||||
# Get target root directory
|
# Get target root directory
|
||||||
if [[ $(uname) == 'Darwin' ]]; then
|
if [[ $(uname) == 'Darwin' ]]; then
|
||||||
# MacOS
|
# MacOS
|
||||||
font_dir="$HOME/Library/Fonts"
|
if [[ "system" == "$installpath" ]]; then
|
||||||
|
font_dir="/Library/Fonts"
|
||||||
|
else
|
||||||
|
font_dir="$HOME/Library/Fonts"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Linux
|
# Linux
|
||||||
font_dir="$HOME/.local/share/fonts"
|
if [[ "system" == "$installpath" ]]; then
|
||||||
|
font_dir="/usr/local/share/fonts"
|
||||||
|
else
|
||||||
|
font_dir="$HOME/.local/share/fonts"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
font_dir="${font_dir}/NerdFonts"
|
font_dir="${font_dir}/NerdFonts"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user