mirror of
https://github.com/fontmgr/MesloLGSNF.git
synced 2025-08-15 01:32:10 +08:00
97 lines
3.6 KiB
Bash
Executable File
97 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
APPNAME="MesloLGSNF"
|
|
USER="${SUDO_USER:-${USER}}"
|
|
HOME="${USER_HOME:-${HOME}}"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
#set opts
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
##@Version : 020820212056-git
|
|
# @Author : Jason Hempstead
|
|
# @Contact : jason@casjaysdev.com
|
|
# @License : WTFPL.md
|
|
# @ReadME : README.md
|
|
# @Copyright : Copyright: (c) 2021 Jason Hempstead, CasjaysDev
|
|
# @Created : Monday, Feb 08, 2021 20:56 EST
|
|
# @File : install.sh
|
|
# @Description : MesloLGSNF fonts
|
|
# @TODO :
|
|
# @Other :
|
|
# @Resource :
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Import functions
|
|
CASJAYSDEVDIR="${CASJAYSDEVDIR:-/usr/local/share/CasjaysDev/scripts}"
|
|
SCRIPTSFUNCTDIR="${CASJAYSDEVDIR:-/usr/local/share/CasjaysDev/scripts}/functions"
|
|
SCRIPTSFUNCTFILE="${SCRIPTSAPPFUNCTFILE:-app-installer.bash}"
|
|
SCRIPTSFUNCTURL="${SCRIPTSAPPFUNCTURL:-https://github.com/dfmgr/installer/raw/main/functions}"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
if [ -f "$PWD/$SCRIPTSFUNCTFILE" ]; then
|
|
. "$PWD/$SCRIPTSFUNCTFILE"
|
|
elif [ -f "$SCRIPTSFUNCTDIR/$SCRIPTSFUNCTFILE" ]; then
|
|
. "$SCRIPTSFUNCTDIR/$SCRIPTSFUNCTFILE"
|
|
else
|
|
echo "Can not load the functions file: $SCRIPTSFUNCTDIR/$SCRIPTSFUNCTFILE" 1>&2
|
|
exit 1
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Call the main function
|
|
system_installdirs
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Make sure the scripts repo is installed
|
|
scripts_check
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Defaults
|
|
APPNAME="${APPNAME:-MesloLGSNF}"
|
|
APPDIR="$SHARE/CasjaysDev/fontmgr/$APPNAME"
|
|
INSTDIR="$SHARE/CasjaysDev/fontmgr/$APPNAME"
|
|
REPO_BRANCH="${GIT_REPO_BRANCH:-master}"
|
|
REPO="${FONTMGRREPO:-https://github.com/fontmgr}/$APPNAME"
|
|
REPORAW="$REPO/raw/$REPO_BRANCH"
|
|
APPVERSION="$(__appversion "$REPORAW/version.txt")"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Require a version higher than
|
|
fontmgr_req_version "$APPVERSION"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Call the fontmgr function
|
|
fontmgr_install
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Script options IE: --help
|
|
show_optvars "$@"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# initialize the installer
|
|
fontmgr_run_init
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Ensure directories exist
|
|
ensure_dirs
|
|
ensure_perms
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# Main progam
|
|
if am_i_online; then
|
|
if [ -d "$INSTDIR/.git" ]; then
|
|
execute "git_update $INSTDIR" "Updating $APPNAME font package"
|
|
else
|
|
execute "git_clone $REPO $INSTDIR" "Installing $APPNAME font package"
|
|
fi
|
|
# exit on fail
|
|
failexitcode $? "Git has failed"
|
|
fi
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# run post install scripts
|
|
run_postinst() {
|
|
fontmgr_run_post
|
|
}
|
|
#
|
|
execute "run_postinst" "Running post install scripts"
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# create version file
|
|
fontmgr_install_version
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# run exit function
|
|
run_exit
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# End application
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
# lets exit with code
|
|
exit ${exitCode:-$?}
|