yage
96992e9344
===================================================================== --- New Scripts -------------------------- zsh ) latex + latex template engine - latex/build-pdf - latex/cleanup - latex/create-new - latex/get-pdf - latex/open-pdf beta SQL script -- got tired of floating this; works, but only OK - db/run-sql/postgres --- Changes ------------------------------ - Added 'math', 'basic', and 'times-new-roman' templates to latex - Added 'readlink' to list of required coreutils - Added __INPUT to read into a variable with prompt (zsh/utils/io) - Added $EXECUTION_DIR to interact with the user's working directory --- Bug Fixes ---------------------------- - subscwrypts no longer force stdout/stderr to tty
42 lines
1013 B
Bash
42 lines
1013 B
Bash
__CHECK_DEPENDENCIES() {
|
|
local DEP ERROR=0
|
|
|
|
for DEP in $*; do __CHECK_DEPENDENCY $DEP || ((ERROR+=1)); done
|
|
__CHECK_COREUTILS || ((ERROR+=$?))
|
|
|
|
return $ERROR
|
|
}
|
|
|
|
__CHECK_DEPENDENCY() {
|
|
local DEPENDENCY="$1"
|
|
[ ! $DEPENDENCY ] && return 1
|
|
command -v $DEPENDENCY >/dev/null 2>&1 || {
|
|
__ERROR "'$1' required but not installed. $(__CREDITS $1)"
|
|
return 1
|
|
}
|
|
}
|
|
|
|
__CHECK_COREUTILS() {
|
|
local COREUTILS=(awk find grep sed readlink)
|
|
local MISSING_DEPENDENCY_COUNT=0
|
|
local NON_GNU_DEPENDENCY_COUNT=0
|
|
|
|
local UTIL
|
|
for UTIL in $(echo $COREUTILS)
|
|
do
|
|
__CHECK_DEPENDENCY $UTIL || { ((MISSING_DEPENDENCY_COUNT+=1)); continue; }
|
|
|
|
$UTIL --version 2>&1 | grep -q 'GNU' || {
|
|
__WARNING "non-GNU version of $UTIL detected"
|
|
((NON_GNU_DEPENDENCY_COUNT+=1))
|
|
}
|
|
done
|
|
|
|
[[ $NON_GNU_DEPENDENCY_COUNT -gt 0 ]] && {
|
|
__WARNING 'scripts rely on GNU coreutils; functionality may be limited'
|
|
__IS_MACOS && __REMINDER 'GNU coreutils can be installed and linked through Homebrew'
|
|
}
|
|
|
|
return $MISSING_DEPENDENCY_COUNT
|
|
}
|