From: Bastian Dehn Date: Sun, 16 Aug 2026 13:59:41 +0000 (+0200) Subject: add check command exists X-Git-Tag: v1.0.7^2~1^2~25 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=41e4c449422ad61022bb194c8d871d9fd9abc593;p=simple-backup.git add check command exists --- diff --git a/src/backupmount b/src/backupmount index 20f31d4..f68157f 100755 --- a/src/backupmount +++ b/src/backupmount @@ -27,6 +27,11 @@ main() local CONFIG_FILE=${CONFIG_FILE:="config.yaml"} exists_needed_commands || return $? echo "⭐ START: backupmount" + + local cmd="$1" + [ -n "$md" ] \ + || errlog "missing command" \ + || return $? } [ "$TESTMODE" == "ON" ] && return 0 diff --git a/tests/backupmount_tests.bats b/tests/backupmount_tests.bats index 786aad5..dc164fd 100755 --- a/tests/backupmount_tests.bats +++ b/tests/backupmount_tests.bats @@ -19,6 +19,7 @@ teardown() { exists_needed_commands() { return 0 } + run main assert_line --index 0 "⭐ START: backupmount" @@ -58,4 +59,17 @@ teardown() { assert_failure assert_line --index 0 "❌ ERROR: command cryptsetup not found" +} + +# bats test_tags=backupmount:start +@test "failure missing command parameter" { + exists_needed_commands() { + return 0 + } + + run main + + assert_failure + assert_line --index 0 "⭐ START: backupmount" + assert_line --index 1 "❌ ERROR: missing command" } \ No newline at end of file