summaryrefslogtreecommitdiff
path: root/old-school
diff options
context:
space:
mode:
Diffstat (limited to 'old-school')
-rw-r--r--old-school/mdadm-dup.sh23
1 files changed, 15 insertions, 8 deletions
diff --git a/old-school/mdadm-dup.sh b/old-school/mdadm-dup.sh
index c13a325..70163a5 100644
--- a/old-school/mdadm-dup.sh
+++ b/old-school/mdadm-dup.sh
@@ -48,13 +48,20 @@ dm_snapshot_teardown()
48 case "$dev" in 48 case "$dev" in
49 /dev/dm-*) 49 /dev/dm-*)
50 dmsetup table "$dev" | ( 50 dmsetup table "$dev" | (
51 read _ _ snapshot ro_dev rw_dev _ _ 51 read _ _ snapshot ro_dev rw_dev _ crypt_dev _
52 [ "$snapshot" = snapshot ] || exit 1 52 case "$snapshot" in
53 dmsetup remove "$dev" || exit 1 53 snapshot)
54 # errors ignored because the loop dev can be configured to be 54 dmsetup remove "$dev" || exit 1
55 # automatically removed upon disuse 55 # errors ignored because the loop dev can be configured to be
56 losetup -d /dev/block/"$rw_dev" || true 56 # automatically removed upon disuse
57 eject /dev/block/"$ro_dev" || true 57 losetup -d /dev/block/"$rw_dev" || true
58 eject /dev/block/"$ro_dev" || true
59 ;;
60 crypt)
61 cryptsetup remove "$dev" || exit 1
62 losetup -d /dev/block/"$crypt_dev" || true
63 ;;
64 esac
58 ) || return 65 ) || return
59 ;; 66 ;;
60 *) return 1 ;; 67 *) return 1 ;;
@@ -129,7 +136,7 @@ cryptsetup_temp()
129 printf %s "$secret" | 136 printf %s "$secret" |
130 cryptsetup --key-file - luksOpen "$cleartext_dev" "$cryptname" || return 137 cryptsetup --key-file - luksOpen "$cleartext_dev" "$cryptname" || return
131 unset secret 138 unset secret
132 set $parms 139 set "$parms"
133 140
134 wait_for_dm_device /dev/mapper/"$cryptname" 141 wait_for_dm_device /dev/mapper/"$cryptname"
135 rm "$temp_file" 142 rm "$temp_file"