You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
Bash
65 lines
1.7 KiB
Bash
#=======================================
|
|
# SETUP
|
|
#=======================================
|
|
|
|
set -u
|
|
|
|
abort() {
|
|
printf "%s\n" "$@" >&2
|
|
exit 1
|
|
}
|
|
|
|
export NEWT_COLORS='
|
|
root=white,black
|
|
border=black,lightgray
|
|
window=lightgray,lightgray
|
|
shadow=black,gray
|
|
title=black,lightgray
|
|
button=black,cyan
|
|
actbutton=white,cyan
|
|
compactbutton=black,lightgray
|
|
checkbox=black,lightgray
|
|
actcheckbox=lightgray,cyan
|
|
entry=black,lightgray
|
|
disentry=gray,lightgray
|
|
label=black,lightgray
|
|
listbox=black,lightgray
|
|
actlistbox=black,cyan
|
|
sellistbox=lightgray,black
|
|
actsellistbox=lightgray,black
|
|
textbox=black,lightgray
|
|
acttextbox=black,cyan
|
|
emptyscale=,gray
|
|
fullscale=,cyan
|
|
helpline=white,black
|
|
roottext=lightgrey,black
|
|
'
|
|
|
|
#=======================================
|
|
# SANITY CHECKS
|
|
#=======================================
|
|
|
|
# Fail fast with a concise message when not using bash
|
|
# Single brackets are needed here for POSIX compatibility
|
|
# shellcheck disable=SC2292
|
|
if [ -z "${BASH_VERSION:-}" ]; then
|
|
abort "Bash is required to interpret this script."
|
|
fi
|
|
|
|
# Check if script is run with force-interactive mode in CI
|
|
if [[ -n "${CI-}" && -n "${INTERACTIVE-}" ]]; then
|
|
abort "Cannot run force-interactive mode in CI."
|
|
fi
|
|
|
|
# Check if both `INTERACTIVE` and `NONINTERACTIVE` are set
|
|
# Always use single-quoted strings with `exp` expressions
|
|
# shellcheck disable=SC2016
|
|
if [[ -n "${INTERACTIVE-}" && -n "${NONINTERACTIVE-}" ]]; then
|
|
abort 'Both `$INTERACTIVE` and `$NONINTERACTIVE` are set. Please unset at least one variable and try again.'
|
|
fi
|
|
|
|
# Check if script is run in POSIX mode
|
|
if [[ -n "${POSIXLY_CORRECT+1}" ]]; then
|
|
abort 'Bash must not run in POSIX mode. Please unset POSIXLY_CORRECT and try again.'
|
|
fi
|