mirror of
https://github.com/fontmgr/MesloLGSNF.git
synced 2025-08-15 01:32:10 +08:00
192 lines
4.4 KiB
Bash
Executable File
192 lines
4.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
APPNAME="$(basename $0)"
|
|
USER="${SUDO_USER:-${USER}}"
|
|
HOME="${USER_HOME:-${HOME}}"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# @Author : Jason
|
|
# @Contact : casjaysdev@casjay.net
|
|
# @File : install.sh
|
|
# @Created : Wed, Aug 09, 2020, 02:00 EST
|
|
# @License : WTFPL
|
|
# @Copyright : Copyright (c) CasjaysDev
|
|
# @Description : installer script for MesloLGSNF font
|
|
#
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Set functions
|
|
|
|
SCRIPTSFUNCTURL="${SCRIPTSAPPFUNCTURL:-https://github.com/casjay-dotfiles/scripts/raw/master/functions}"
|
|
SCRIPTSFUNCTDIR="${SCRIPTSAPPFUNCTDIR:-/usr/local/share/CasjaysDev/scripts}"
|
|
SCRIPTSFUNCTFILE="${SCRIPTSAPPFUNCTFILE:-app-installer.bash}"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if [ -f "$SCRIPTSFUNCTDIR/functions/$SCRIPTSFUNCTFILE" ]; then
|
|
. "$SCRIPTSFUNCTDIR/functions/$SCRIPTSFUNCTFILE"
|
|
elif [ -f "$HOME/.local/share/CasjaysDev/functions/$SCRIPTSFUNCTFILE" ]; then
|
|
. "$HOME/.local/share/CasjaysDev/functions/$SCRIPTSFUNCTFILE"
|
|
else
|
|
mkdir -p "/tmp/CasjaysDev/functions"
|
|
curl -LSs "$SCRIPTSFUNCTURL/$SCRIPTSFUNCTFILE" -o "/tmp/CasjaysDev/functions/$SCRIPTSFUNCTFILE" || exit 1
|
|
. "/tmp/CasjaysDev/functions/$SCRIPTSFUNCTFILE"
|
|
fi
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Make sure the scripts repo is installed
|
|
|
|
#scripts_check
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Defaults
|
|
|
|
APPNAME="MesloLGSNF"
|
|
PLUGNAME=""
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# git repos
|
|
|
|
PLUGINREPO=""
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Version
|
|
|
|
APPVERSION="$(curl -LSs ${FONTMGRREPO:-https://github.com/fontmgr}/$APPNAME/raw/master/version.txt)"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# set the install type
|
|
|
|
font_installer
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Set options
|
|
|
|
APPDIR="$SHARE/CasjaysDev/fontmgr/$APPNAME"
|
|
PLUGDIR="$SHARE/$APPNAME/${PLUGNAME:-plugins}"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Script options IE: --help
|
|
|
|
show_optvars "$@"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Requires root - no point in continuing
|
|
|
|
#sudoreq # sudo required
|
|
#sudorun # sudo optional
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# end with a space
|
|
|
|
APP=""
|
|
PERL=""
|
|
PYTH=""
|
|
PIPS=""
|
|
CPAN=""
|
|
GEMS=""
|
|
|
|
# install packages - useful for package that have the same name on all oses
|
|
install_packages $APP
|
|
|
|
# install required packages using file
|
|
install_required $APP
|
|
|
|
# check for perl modules and install using system package manager
|
|
install_perl $PERL
|
|
|
|
# check for python modules and install using system package manager
|
|
install_python $PYTH
|
|
|
|
# check for pip binaries and install using python package manager
|
|
install_pip $PIPS
|
|
|
|
# check for cpan binaries and install using perl package manager
|
|
install_cpan $CPAN
|
|
|
|
# check for ruby binaries and install using ruby package manager
|
|
install_gem $GEMS
|
|
|
|
# Other dependencies
|
|
dotfilesreq
|
|
dotfilesreqadmin
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Ensure directories exist
|
|
|
|
ensure_dirs
|
|
ensure_perms
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Main progam
|
|
|
|
if [ -d "$APPDIR/.git" ]; then
|
|
execute \
|
|
"git_update $APPDIR" \
|
|
"Updating $APPNAME fonts"
|
|
else
|
|
execute \
|
|
"backupapp && \
|
|
git_clone -q $REPO/$APPNAME $APPDIR" \
|
|
"Installing $APPNAME fonts"
|
|
fi
|
|
|
|
# exit on fail
|
|
failexitcode
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# Plugins
|
|
|
|
if [ "$PLUGNAME" != "" ]; then
|
|
if [ -d "$PLUGDIR"/.git ]; then
|
|
execute \
|
|
"git_update $PLUGDIR" \
|
|
"Updating $PLUGNAME"
|
|
else
|
|
execute \
|
|
"git_clone $PLUGINREPO $PLUGDIR" \
|
|
"Installing $PLUGNAME"
|
|
fi
|
|
fi
|
|
|
|
# exit on fail
|
|
failexitcode
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# run post install scripts
|
|
|
|
run_postinst() {
|
|
run_postinst_global
|
|
|
|
}
|
|
|
|
execute \
|
|
"run_postinst" \
|
|
"Running post install scripts"
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# create version file
|
|
|
|
install_fontmgr_version
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# exit
|
|
run_exit
|
|
|
|
# end
|