blob: 0d5eba7b4b8ccbd76399dd7884b95b9f31271516 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# vim: set ft=sh:
run_hook () {
if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then
mount_handler="archiso_loop_mount_handler"
fi
}
archiso_loop_mount_handler () {
newroot="${1}"
while [ ! -b "${img_dev}" ]; do
sleep 1
done
msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}"
FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null)
if [ -n "${FSTYPE}" ]; then
if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then
_dev_loop=$(losetup -f)
losetup ${_dev_loop} /img_dev/${img_loop}
fi
fi
archiso_mount_handler ${newroot}
if [ "${copytoram}" = "y" ]; then
msg "::: Deataching loop device ${_dev_loop}"
losetup -d ${_dev_loop}
msg "::: Unmounting ${img_dev}"
umount ${img_dev}
fi
}
|