2010-12-01 02:16:19 +01:00
|
|
|
# vim: set ft=sh:
|
|
|
|
|
|
|
|
run_hook () {
|
2011-10-24 02:24:17 +02:00
|
|
|
[[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
|
|
|
|
if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then
|
2010-12-01 02:16:19 +01:00
|
|
|
mount_handler="archiso_loop_mount_handler"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
archiso_loop_mount_handler () {
|
|
|
|
newroot="${1}"
|
|
|
|
|
2012-01-10 00:33:35 +01:00
|
|
|
local _dev_loop
|
|
|
|
|
2011-10-24 02:24:17 +02:00
|
|
|
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
|
2011-11-28 14:35:05 +01:00
|
|
|
_mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r"
|
2012-02-22 23:41:32 +01:00
|
|
|
if [[ "${copytoram}" != "y" ]]; then
|
|
|
|
echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices
|
|
|
|
fi
|
2011-10-24 02:24:17 +02:00
|
|
|
|
2015-08-30 00:39:41 +02:00
|
|
|
if _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then
|
|
|
|
archisodevice="${_dev_loop}"
|
|
|
|
else
|
2012-01-10 00:33:35 +01:00
|
|
|
echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'"
|
2010-12-08 18:44:48 +01:00
|
|
|
launch_interactive_shell
|
2010-12-01 02:16:19 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
archiso_mount_handler ${newroot}
|
|
|
|
|
2011-10-24 02:24:17 +02:00
|
|
|
if [[ "${copytoram}" == "y" ]]; then
|
2015-05-28 08:59:41 +02:00
|
|
|
losetup -d ${_dev_loop} 2>/dev/null
|
2011-10-24 02:24:17 +02:00
|
|
|
umount /run/archiso/img_dev
|
2010-12-01 02:16:19 +01:00
|
|
|
fi
|
|
|
|
}
|