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
1 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,20 @@ if [[ ! -d "${output_dir}" ]]; then
exit 1;
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")";
on_exit() {
log_msg "Cleaning up";