[Git-commits] [grml/grml2usb] ef2f28: Avoid custom boot options getting duplicated when ...

Michael Prokop noreply at github.com
Tue Jun 4 11:03:45 CEST 2019


  Branch: refs/heads/master
  Home:   https://github.com/grml/grml2usb
  Commit: ef2f28e996c9d5b6313be87ee957c0d9a578e822
      https://github.com/grml/grml2usb/commit/ef2f28e996c9d5b6313be87ee957c0d9a578e822
  Author: Michael Prokop <mika at grml.org>
  Date:   2019-06-04 (Tue, 04 Jun 2019)

  Changed paths:
    M grml2usb

  Log Message:
  -----------
  Avoid custom boot options getting duplicated when used with multiple ISOs

grml2usb can be invoked with multiple ISOs *and* custom boot options, like:

  % sudo grml2usb --bootoption="ssh=foobar mikawashere" grml32-small_2018.12.iso grml64-small_2018.12.iso /dev/sdb1

Then grml2usb appends the custom boot options in the GRUB
(boot/grub/*.cfg) + isolinux/syslinux (boot/syslinux/*.cfg)
configuration files of files that have been installed by the underlying
grml32-small ISO.

But when hitting the grml64-small ISO then, it continues to replace the
files with the boot options once again. Therefore we end up with
duplicate boot options in the grml32-small_2018.12.iso specific files
(boot/grub/grml32small_default.cfg, boot/grub/grml32small_options.cfg,
boot/syslinux/grml32_small_default.cfg, boot/syslinux/grml32_small_grml.cfg +
boot/syslinux/hidden.cfg).

We could actually ensure to only touch the ISO specific files, but
we don't have version information included in the file names and also
have shared files like boot/syslinux/hidden.cfg, so this might unexpected
side effects as well. So instead let's explicitly check for the provided
custom boot options.

Notes regarding the implementation:

* If boot options are whitespace-only or empty, nothing will happen. This
  prevents str.replace to do unintended things.

* otherwise consider string "PRE some-boot-options POST". Then we should find
  'some-boot-options' and remove them. Why the delimiter handling? Consider
  some-boot-options is 'ssh'. If we replace line.replace(bootopt, '') then some
  fictitious boot option like 'service.ssh=autostart' would be broken. Thus the
  space delimiters are necessary.

* However, the space delimiters might not exist if the boot options occur at the
  end of the string. Thus special handling is required for this case.

Thanks: Ralf Moll for the bug report and Lukas Prokop for providing the bug fix




More information about the Git-commits mailing list