{
local media="$1"
local partition=$(cat config.yaml \
- | yq --raw-output ".media\"$media\".partition")
- [ "$partition" == "null" ] \
+ | yq --raw-output ".media.\"$media\".partition")
+ [ "$partition" != "null" ] \
|| errlog "config.yaml partition for $media missing" \
|| return $?
[ -b "$partition" ] \
local backup_path=$(cat config.yaml \
| yq --raw-output ".backup_path")
[ "$backup_path" == "null" ] \
- || errlog "config.yaml backup path missing"
+ || errlog "config.yaml backup path missing" \
|| return $?
infolog "backup path $backup_path"
|| return $?
infolog "use key $key"
local volume=$(cat "config.yaml" \
- | yq --raw-output ".media.volume")
+ | yq --raw-output ".backup_volume")
[ "$volume" != "null" ] \
|| errlog "config.yaml volume for $media missing" \
|| return $?
cryptsetup open --key-file "$key" \
"$device" \
"$volume" \
- || errlog "could not open $device with $key"
+ || errlog "could not open $device with $key" \
|| return $?
partition_mount "$media" || return $?
local backup_path=$(cat config.yaml \
| yq --raw-output ".backup_path")
[ "$backup_path" == "null" ] \
- || errlog "config.yaml backup path missing"
+ || errlog "config.yaml backup path missing" \
|| return $?
infolog "umount backup path $backup_path"
infolog "close volume"
local volume=$(cat "config.yaml" \
- | yq --raw-output ".media.volume")
+ | yq --raw-output ".backup_volume")
[ "$volume" != "null" ] \
|| errlog "config.yaml volume for $media missing" \
|| return $?