ISO/archiso/hooks/archiso_loop_mnt
Gerardo Exequiel Pozzi 90fb8ea480 [archiso] Mount all fs on /run/archiso instead of /
This allow to take control again of these mountpoints outside initramfs.
(i.e: on deinitramfs stage at shutdown for unmount it)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-10-23 21:24:17 -03:00

39 lines
1.2 KiB
Bash

# 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}"
msg ":: Waiting for boot device..."
while ! poll_device ${img_dev} 30; do
echo "ERROR: boot device didn't show up after 30 seconds..."
echo " Falling back to interactive prompt"
echo " You can try to fix the problem manually, log out when you are finished"
launch_interactive_shell
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
mkdir -p /run/archiso/img_dev
if mount -r -t "${FSTYPE}" ${img_dev} /run/archiso/img_dev > /dev/null 2>&1; then
_dev_loop=$(losetup -f)
losetup ${_dev_loop} /run/archiso/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
}