return $lastexit
}
+exists_needed_commands()
+{
+ command -v yq > /dev/null \
+ || errlog "command yq not found" \
+ || return $?
+ command -v jq > /dev/null \
+ || errlog "command jq not found" \
+ || return $?
+ command -v rsync > /dev/null \
+ || errlog "command rsync not found" \
+ || return $?
+ command -v ssh > /dev/null \
+ || errlog "command ssh not found" \
+ || return $?
+}
+
exists_config_file()
{
local config_file="$1"
local CONFIG_FILE=${CONFIG_FILE:="config.yaml"}
echo "⭐ START: backup"
- command -v yq > /dev/null \
- || errlog "command yq not found" \
- || return $?
- command -v jq > /dev/null \
- || errlog "command jq not found" \
- || return $?
- command -v rsync > /dev/null \
- || errlog "command rsync not found" \
- || return $?
- command -v ssh > /dev/null \
- || errlog "command ssh not found" \
- || return $?
- exists_config_file "$CONFIG_FILE" \
- || return $?
+ exists_needed_commands || return $?
+ exists_config_file "$CONFIG_FILE" || return $?
local config=
config=$(yq '.' "$CONFIG_FILE") \