diff options
-rwxr-xr-x | old-school/grok-block | 3 | ||||
-rw-r--r-- | old-school/mdadm-dup.sh | 11 |
2 files changed, 7 insertions, 7 deletions
diff --git a/old-school/grok-block b/old-school/grok-block index 3f61c4a..006a090 100755 --- a/old-school/grok-block +++ b/old-school/grok-block | |||
@@ -173,8 +173,7 @@ then | |||
173 | if ! mountpoint -q /cdrom; then | 173 | if ! mountpoint -q /cdrom; then |
174 | mkdir -p /cdrom | 174 | mkdir -p /cdrom |
175 | . mdadm-dup.sh | 175 | . mdadm-dup.sh |
176 | mount_cdrom "$DEVNAME" && bootdone samizdat-cdrom | 176 | dup_mount_cdrom "$DEVNAME" /cdrom && bootdone samizdat-cdrom |
177 | # (retry_mount -t iso9660 -r "$DEVNAME" /cdrom && bootdone samizdat-cdrom) & | ||
178 | fi | 177 | fi |
179 | else | 178 | else |
180 | grok_block & | 179 | grok_block & |
diff --git a/old-school/mdadm-dup.sh b/old-school/mdadm-dup.sh index 27a39ca..b1bcd33 100644 --- a/old-school/mdadm-dup.sh +++ b/old-school/mdadm-dup.sh | |||
@@ -41,7 +41,8 @@ dm_snapshot_teardown() | |||
41 | read _ _ snapshot ro_dev rw_dev _ _ | 41 | read _ _ snapshot ro_dev rw_dev _ _ |
42 | [ "$snapshot" = snapshot ] || exit 1 | 42 | [ "$snapshot" = snapshot ] || exit 1 |
43 | dmsetup remove "$dev" || exit 1 | 43 | dmsetup remove "$dev" || exit 1 |
44 | # errors ignored because the loop dev can be automatically removed upon disuse already | 44 | # errors ignored because the loop dev can be configured to be |
45 | # automatically removed upon disuse | ||
45 | losetup -d /dev/block/"$rw_dev" || true | 46 | losetup -d /dev/block/"$rw_dev" || true |
46 | eject /dev/block/"$ro_dev" || exit 1 | 47 | eject /dev/block/"$ro_dev" || exit 1 |
47 | ) || return | 48 | ) || return |
@@ -58,11 +59,11 @@ wait_for_dm_device() | |||
58 | done | 59 | done |
59 | } | 60 | } |
60 | 61 | ||
61 | mount_cdrom() | 62 | dup_mount_cdrom() |
62 | { | 63 | { |
63 | local cdrom_dev="$1" | 64 | local cdrom_dev="$1" mountpoint="$2" |
64 | 65 | ||
65 | local sectors md_dev=/dev/md0 cdrom_rw_file=/"${cdrom_dev##*/}".rw | 66 | local sectors md_dev=/dev/md55 cdrom_rw_file=/"${cdrom_dev##*/}".rw |
66 | 67 | ||
67 | sectors=$(get_cdrom_sizelimit "$cdrom_dev") || return | 68 | sectors=$(get_cdrom_sizelimit "$cdrom_dev") || return |
68 | 69 | ||
@@ -72,7 +73,7 @@ mount_cdrom() | |||
72 | dd if=/dev/zero of="$cdrom_rw_file" bs=1K count=32 || return | 73 | dd if=/dev/zero of="$cdrom_rw_file" bs=1K count=32 || return |
73 | cdrom_rw_dev=$(dm_snapshot "$cdrom_dev" "$cdrom_rw_file" "$sectors") || return | 74 | cdrom_rw_dev=$(dm_snapshot "$cdrom_dev" "$cdrom_rw_file" "$sectors") || return |
74 | mdadm_dup "$cdrom_rw_dev" "$md_dev" "$sectors" || return | 75 | mdadm_dup "$cdrom_rw_dev" "$md_dev" "$sectors" || return |
75 | mount -t iso9660 -r $md_dev /cdrom | 76 | mount -t iso9660 -r $md_dev "$mountpoint" |
76 | } | 77 | } |
77 | 78 | ||
78 | get_cdrom_sizelimit() | 79 | get_cdrom_sizelimit() |