add cmd addfonts
This commit is contained in:
parent
0e36a3a145
commit
5dcf01eff2
36
shell/dot-local/bin/addfonts
Normal file
36
shell/dot-local/bin/addfonts
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
function install() {
|
||||
name=$1
|
||||
src_dir=$2
|
||||
|
||||
mkdir -p /usr/share/fonts/$name
|
||||
cp $src_dir/*.ttf /usr/share/fonts/$name/
|
||||
chmod 0775 /usr/share/fonts/$name
|
||||
chmod 0664 /usr/share/fonts/$name/*
|
||||
}
|
||||
|
||||
function help() {
|
||||
echo "$0 <font name> <sorce dir>"
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ -z "$2" ]]; then
|
||||
echo "ERROR: give at least two arguments"
|
||||
echo
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -d "$2" ]]; then
|
||||
echo "ERROR: $2 is not a directory"
|
||||
echo
|
||||
help
|
||||
exit
|
||||
fi
|
||||
|
||||
install $1 "$2"
|
||||
Loading…
x
Reference in New Issue
Block a user