bundles/zfs: no 'set -e' in backup-pre-hook
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
976aa251d1
commit
3e9c28b8ae
1 changed files with 16 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
errors=0
|
||||
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-pre.d
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-pre.d || errors=1
|
||||
|
||||
|
||||
% for dataset in sorted(node.metadata.get('zfs/filesystems_with_backup_snapshots')):
|
||||
|
@ -10,19 +10,27 @@ mountpoint="/mnt/backup-snapshot${node.metadata['zfs']['datasets'][dataset]['mou
|
|||
|
||||
if findmnt "$mountpoint" >/dev/null
|
||||
then
|
||||
umount "$mountpoint"
|
||||
umount "$mountpoint" || errors=1
|
||||
fi
|
||||
|
||||
if zfs get type "${dataset}@snapshot-backup" >/dev/null 2>&1
|
||||
then
|
||||
zfs destroy "${dataset}@snapshot-backup"
|
||||
zfs destroy "${dataset}@snapshot-backup" || errors=1
|
||||
fi
|
||||
|
||||
zfs snapshot "${dataset}@snapshot-backup"
|
||||
zfs snapshot "${dataset}@snapshot-backup" || errors=1
|
||||
|
||||
mkdir -p "$mountpoint"
|
||||
mount -t zfs "${dataset}@snapshot-backup" "$mountpoint"
|
||||
mkdir -p "$mountpoint" || errors=1
|
||||
mount -t zfs "${dataset}@snapshot-backup" "$mountpoint" || errors=1
|
||||
|
||||
|
||||
% endfor
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-post.d
|
||||
run-parts --exit-on-error -- /etc/zfs-snapshot-backup-post.d || errors=1
|
||||
|
||||
if (( errors ))
|
||||
then
|
||||
# We can't use 'set -e' in here, because this could result in services
|
||||
# not getting started, if they need to get stopped before creating a
|
||||
# consistent backup snapshot.
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue