simplify helper funcs

This commit is contained in:
Ella Stanforth 2021-11-01 10:17:07 +00:00
parent 33cc849fc8
commit 2fe2fa20ac

View file

@ -19,24 +19,22 @@ warn() {
assert_file() { assert_file() {
stat "$1" \ stat "$1" \
> /dev/null \ > /dev/null \
2> /dev/null && return 2> /dev/null \
|| fatal "$1 does not exist!"
fatal "$1 does not exist!"
} }
assert_func() { assert_func() {
command -V "$1" \ command -V "$1" \
> /dev/null \ > /dev/null \
2> /dev/null && return 2> /dev/null \
fatal "build.sh not sane: $1 not defined!" || fatal "build.sh not sane: $1 not defined!"
} }
make_dir() { make_dir() {
stat "$1" \ stat "$1" \
> /dev/null \ > /dev/null \
2> /dev/null && return 2> /dev/null \
|| mkdir -p "$1"
mkdir -p "$1"
} }
# fetch file, checks the md5sum and only curls if needed # fetch file, checks the md5sum and only curls if needed