Utilities revamped
docker-system install moved into sz-install improvement of functionality and output on all other scripts
This commit is contained in:
parent
d6a9f59544
commit
726463c3ab
5 changed files with 284 additions and 75 deletions
|
@ -80,25 +80,10 @@ function _repo_custom_xscreensavers() {
|
|||
|
||||
############ Script Logic starts here
|
||||
set -e
|
||||
|
||||
ANSI_Print() { printf "\E[${ANSI_Code}m%s\E[0m" "$@"; }
|
||||
ANSI_Red() { ANSI_Code=31 ANSI_Print "$@"; }
|
||||
ANSI_Green() { ANSI_Code=32 ANSI_Print "$@"; }
|
||||
ANSI_Yellow() { ANSI_Code=33 ANSI_Print "$@"; }
|
||||
ANSI_Blue() { ANSI_Code=34 ANSI_Print "$@"; }
|
||||
ANSI_Indiego() { ANSI_Code=35 ANSI_Print "$@"; }
|
||||
ANSI_Cyan() { ANSI_Code=36 ANSI_Print "$@"; }
|
||||
|
||||
error() {
|
||||
(>&2 ANSI_Red 'ERROR: ' && printf '%s\n' "$@" )
|
||||
}
|
||||
|
||||
require_root() {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
error "This script should only be run using sudo or as the root user"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
USER_HOME=$HOME
|
||||
[[ -n "${SUDO_USER}" ]] && USER_HOME="$(eval "echo ~${SUDO_USER}")"
|
||||
. ${SHRC_D:-$USER_HOME/.pqb.shrc.d}/01_util.functions
|
||||
|
||||
# The function that does the _Heavy Lifting_.
|
||||
# see the code that follows for the parameter signature
|
||||
|
@ -111,14 +96,14 @@ function add_repo() {
|
|||
return $?
|
||||
# If no repo defintion exist, exit with an error
|
||||
elif [[ "$(type -t _repo_$1)" != 'function' ]]; then
|
||||
error "Can't configure $1, could not find _repo_$1 definition!"
|
||||
eval $(error 1 "Can't configure $1, could not find _repo_$1 definition!") || return $?
|
||||
return 1
|
||||
fi
|
||||
# Grab the repo's defintion
|
||||
eval "_repo_$1"
|
||||
|
||||
# Prepare all necessary vraiables
|
||||
[[ -z "$REPO_FQDN" ]] && error "REPO_FQDN not defined for '$1'" && return 1
|
||||
[[ -z "$REPO_FQDN" ]] && eval $(error 1 "REPO_FQDN not defined for '$1'")
|
||||
GPG_KEY_URL=${GPG_KEY_URL:-https:\/\/$REPO_FQDN\/gpg}
|
||||
GPG_KEY_PATH=${GPG_KEY_PATH:-/usr/share/keyrings/$REPO_FQDN.gpg}
|
||||
REPO_ARCH=${REPO_ARCH:-${_ARC}}
|
||||
|
@ -225,4 +210,4 @@ else
|
|||
done < <( eval $READCMD )
|
||||
|
||||
main
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue