paperless-ng: check for required commands

This commit is contained in:
Starbeamrainbowlabs 2021-04-23 20:41:31 +01:00
parent ddebb2c02a
commit 83108c82ba
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -26,6 +26,20 @@ if [[ ! -d "${output_dir}" ]]; then
exit 1; exit 1;
fi fi
# $1 - Command name to check for
check_command() {
which $1 >/dev/null 2>&1; exit_code=$?
if [[ "${exit_code}" -ne 0 ]]; then
log_msg "Error: Couldn't locate $1. Make sure it's installed and in your path.";
fi
}
check_command mktemp;
check_command curl;
check_command jq;
temp_dir="$(mktemp --tmpdir -d "docker-images-paperless-ng-XXXXXXX")"; temp_dir="$(mktemp --tmpdir -d "docker-images-paperless-ng-XXXXXXX")";
on_exit() { on_exit() {
log_msg "Cleaning up"; log_msg "Cleaning up";