dotfiles/private_dot_local/bin/executable_addfonts

37 lines
541 B
Bash

#!/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"