index : archiso32 | |
Archlinux32 iso tools | gitolite user |
summaryrefslogtreecommitdiff |
author | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2010-11-30 22:16:19 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2010-12-07 23:48:24 -0300 |
commit | 06a8c66eaec5d1bace2ddefc2220c172d81eb2ff (patch) | |
tree | 99b5d3cf83a9c5ed6dd441d9078652e14336009e /archiso/hooks/archiso_loop_mnt | |
parent | cd73f7dfb1f741d7be90a14c11b69de4965263b2 (diff) |
-rw-r--r-- | archiso/hooks/archiso_loop_mnt | 33 |
diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt new file mode 100644 index 0000000..0d5eba7 --- /dev/null +++ b/archiso/hooks/archiso_loop_mnt @@ -0,0 +1,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 +} |