[arch-releng] [PATCH] cleaner boot from loopmounted iso file
Currently, when booting loopmounted iso file, it is necessary to specify not only img_dev and img_loop (which should be sufficient), but also archisolabel or archisodevice. With this patch, archisodevice is directly populated with the correct loop device, and it is not necessary to specify the label when booting from loopmounted iso, which makes for leaner and cleaner grub.cfg. --- archiso/initcpio/hooks/archiso_loop_mnt | 4 +++- docs/README.altbootmethods | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/archiso/initcpio/hooks/archiso_loop_mnt b/archiso/initcpio/hooks/archiso_loop_mnt index 46338e5..f95a47d 100644 --- a/archiso/initcpio/hooks/archiso_loop_mnt +++ b/archiso/initcpio/hooks/archiso_loop_mnt @@ -18,7 +18,9 @@ archiso_loop_mount_handler () { echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices fi - if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + if _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + archisodevice="${_dev_loop}" + else echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" launch_interactive_shell fi diff --git a/docs/README.altbootmethods b/docs/README.altbootmethods index 3c07e03..9df20ef 100644 --- a/docs/README.altbootmethods +++ b/docs/README.altbootmethods @@ -31,14 +31,14 @@ Note: Described method is for using with GRUB2. menuentry "Arch Linux (x86_64)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/x86_64/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/x86_64/archiso.img } menuentry "Arch Linux (i686)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/i686/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/i686/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/i686/archiso.img } -- 2.5.0
On 08/29/2015 07:39 PM, Adam Purkrt wrote:
Currently, when booting loopmounted iso file, it is necessary to specify not only img_dev and img_loop (which should be sufficient), but also archisolabel or archisodevice. With this patch, archisodevice is directly populated with the correct loop device, and it is not necessary to specify the label when booting from loopmounted iso, which makes for leaner and cleaner grub.cfg. --- archiso/initcpio/hooks/archiso_loop_mnt | 4 +++- docs/README.altbootmethods | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/archiso/initcpio/hooks/archiso_loop_mnt b/archiso/initcpio/hooks/archiso_loop_mnt index 46338e5..f95a47d 100644 --- a/archiso/initcpio/hooks/archiso_loop_mnt +++ b/archiso/initcpio/hooks/archiso_loop_mnt @@ -18,7 +18,9 @@ archiso_loop_mount_handler () { echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices fi
- if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + if _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + archisodevice="${_dev_loop}" + else echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" launch_interactive_shell fi diff --git a/docs/README.altbootmethods b/docs/README.altbootmethods index 3c07e03..9df20ef 100644 --- a/docs/README.altbootmethods +++ b/docs/README.altbootmethods @@ -31,14 +31,14 @@ Note: Described method is for using with GRUB2. menuentry "Arch Linux (x86_64)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/x86_64/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/x86_64/archiso.img }
menuentry "Arch Linux (i686)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/i686/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/i686/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/i686/archiso.img }
Thanks!
On 08/31/2015 05:47 AM, Gerardo Exequiel Pozzi wrote:
On 08/29/2015 07:39 PM, Adam Purkrt wrote:
Currently, when booting loopmounted iso file, it is necessary to specify not only img_dev and img_loop (which should be sufficient), but also archisolabel or archisodevice. With this patch, archisodevice is directly populated with the correct loop device, and it is not necessary to specify the label when booting from loopmounted iso, which makes for leaner and cleaner grub.cfg. --- archiso/initcpio/hooks/archiso_loop_mnt | 4 +++- docs/README.altbootmethods | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/archiso/initcpio/hooks/archiso_loop_mnt b/archiso/initcpio/hooks/archiso_loop_mnt index 46338e5..f95a47d 100644 --- a/archiso/initcpio/hooks/archiso_loop_mnt +++ b/archiso/initcpio/hooks/archiso_loop_mnt @@ -18,7 +18,9 @@ archiso_loop_mount_handler () { echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices fi
- if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + if _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + archisodevice="${_dev_loop}" + else echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" launch_interactive_shell fi diff --git a/docs/README.altbootmethods b/docs/README.altbootmethods index 3c07e03..9df20ef 100644 --- a/docs/README.altbootmethods +++ b/docs/README.altbootmethods @@ -31,14 +31,14 @@ Note: Described method is for using with GRUB2. menuentry "Arch Linux (x86_64)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/x86_64/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/x86_64/archiso.img }
menuentry "Arch Linux (i686)" { set isofile="/<TARGET-PATH>/archlinux-<YYYY>.<MM>.<DD>-dual.iso" loopback loop (hd<D>,<P>)$isofile - linux (loop)/arch/boot/i686/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + linux (loop)/arch/boot/i686/vmlinuz img_label=<TARGET-FS-LABEL> img_loop=$isofile initrd (loop)/arch/boot/i686/archiso.img }
Thanks!
Glad to help. Hopefully it's ok to merge.
participants (2)
-
Adam Purkrt
-
Gerardo Exequiel Pozzi