Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2011-10-23 21:24:17 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2011-10-23 21:24:17 -0300
commit908551ef02771d370436b44c42db2c32a74e4a88 (patch)
tree82c3183f3c7ab79b941e322516c1e95d20a5aaf1
parent90fb8ea480dd2cc475963c0f29a412c9366c3f98 (diff)
[archiso] Add support for img_label= and allow img_dev same as cow_dev
* Support img_label= * Allow use img_dev= as cow_device= * Use new function _mnt_dev() from archiso. * Check for error while setting loopback device. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rw-r--r--README4
-rw-r--r--archiso/hooks/archiso_loop_mnt35
2 files changed, 20 insertions, 19 deletions
diff --git a/README b/README
index 16c318f..8a808cf 100644
--- a/README
+++ b/README
@@ -79,8 +79,10 @@ INDEX
** hooks/archiso_loop_mnt
-* img_dev= Device where archiso-image.iso reside.
+* img_label= Set the filesystem label where archiso-image.iso.
Default: (unset)
+* img_dev= Device where archiso-image.iso reside.
+ Default: (unset) or "/dev/disk/by-label/${img_label}"
* img_loop= Full path where archiso-image.iso is located on ${img_dev}
Default: (unset)
diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt
index 18419e3..c1b25df 100644
--- a/archiso/hooks/archiso_loop_mnt
+++ b/archiso/hooks/archiso_loop_mnt
@@ -1,7 +1,8 @@
# vim: set ft=sh:
run_hook () {
- if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then
+ [[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
+ if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then
mount_handler="archiso_loop_mount_handler"
fi
}
@@ -9,30 +10,28 @@ run_hook () {
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..."
+ msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
+ if [[ "${img_dev}" -ef "${cow_device}" ]]; then
+ _mnt_dev "${img_dev}" "/run/archiso/img_dev"
+ else
+ _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r"
+ fi
+
+ _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}'"
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}"
+ if [[ "${copytoram}" == "y" ]]; then
losetup -d ${_dev_loop}
- msg "::: Unmounting ${img_dev}"
- umount ${img_dev}
+ umount /run/archiso/img_dev
+ else
+ echo ${_dev_loop} > /run/archiso/img_dev_loop
fi
}