mirror of https://github.com/digint/btrbk
btrbk-verify: add workaround for btrbk <= 0.27.2 bug: missing target_rsh, target_type
btrbk <= 0.27.2 does not print "target_rsh" and "target_type" when called with --format=raw, see $table_formats{resolved}. This is fixed in 0.28.0. Hardcoding target_type=send-receive is not so bad, as for raw targets btrbk-verify complains first with: btrbk-verify: missing required variable "target_rsh" in btrbk --format=raw line So we should not run rsync (which is not really a problem, rsync just fails with "not a directory").pull/274/head
parent
9ed41c8937
commit
805d7f4a0d
|
@ -313,6 +313,19 @@ eval_btrbk_resolved_line()
|
|||
# basic input validation, set prefixed variable (eval)
|
||||
local var_assignment=$(echo "$line" | grep -Eo "${vv}"'="[^"]*"')
|
||||
if [[ $? -ne 0 ]] || [[ -z "$var_assignment" ]]; then
|
||||
if [[ $vv == "target_type" ]]; then
|
||||
# hack for btrbk <= 0.27.2 bug: missing "target_type" in $table_formats{resolved}
|
||||
# hardcode send-receive type, this results in rsync failing on raw targets with:
|
||||
# rsync: ERROR: cannot stat destination "xxx.btrfs.xz.gpg/": Not a directory (20)
|
||||
eval "${prefix}target_type=\"send-receive\"" || return 1
|
||||
continue
|
||||
fi
|
||||
if [[ $vv == "target_rsh" ]] && [[ -z "$R_target_host" ]]; then
|
||||
# hack for btrbk <= 0.27.2 bug: missing "target_rsh" in $table_formats{resolved}
|
||||
# note that target_rsh is not needed if target_host is not set.
|
||||
# variable has already been reset above, continue
|
||||
continue
|
||||
fi
|
||||
log_line "btrbk-verify: missing required variable \"${vv}\" in btrbk --format=raw line"
|
||||
return 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue