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}"
|
|
|
|
|
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"
|
2011-10-24 02:24:17 +02:00
|
|
|
|
|
|
|
_dev_loop=$(losetup -f)
|
|
|
|
if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then
|
|
|
|
echo "ERROR: Setting loopback device '${_dev_loop}'"
|
|
|
|
echo " for file '/run/archiso/img_dev/${img_loop}'"
|
2010-12-08 18:44:48 +01:00
|
|
|
echo " Falling back to interactive prompt"
|
|
|
|
echo " You can try to fix the problem manually, log out when you are finished"
|
|
|
|
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
|
2010-12-01 02:16:19 +01:00
|
|
|
losetup -d ${_dev_loop}
|
2011-10-24 02:24:17 +02:00
|
|
|
umount /run/archiso/img_dev
|
|
|
|
else
|
|
|
|
echo ${_dev_loop} > /run/archiso/img_dev_loop
|
2010-12-01 02:16:19 +01:00
|
|
|
fi
|
|
|
|
}
|