Fix utility sourcing

Utilities should always be sourced, even in the case that the processor
is not designated for any of the templates provided.
This commit is contained in:
Marty Oehme 2020-02-15 15:25:20 +01:00
parent ea2dc1bd93
commit 7ec6dc98c9
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
6 changed files with 30 additions and 36 deletions

View file

@ -98,17 +98,16 @@ include() {
fi
}
# Safe sourcing: https://stackoverflow.com/a/12694189
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
# shellcheck source=utilities.sh
. "$DIR/utilities.sh"
## Dependency Checker
#
# Makes sure the processor is called for the correct
# base16 package, or refuses to run if it is not.
if printf '%s\n' "${dependency[@]}" | grep -q -P "^$package$"; then
# Safe sourcing: https://stackoverflow.com/a/12694189
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
# shellcheck source=utilities.sh
. "$DIR/utilities.sh"
main
else
dbg_msg $app "error" "Processor does not work for package $package"