[iso] change the Ubuntu-type grub.cfg persistence token

* Among other nefarious things, ubuntu 20.04 added a $casper_flavour suffix
  to their grub.cfg /casper/vmlinuz kernel option, so we can no longer rely
  on 'persistent' being inserted in a proper location.
* Switch to latching on file=/cdrom/preseed and hope that it will work for
  all of Ubuntu & derivatives.
* Part of #1499.
This commit is contained in:
Pete Batard 2020-04-04 18:04:31 +01:00
parent b19f47f9b8
commit 045f590c3b
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 8 additions and 10 deletions

View file

@ -309,12 +309,10 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha
// Add persistence to the kernel options
if ((boot_type == BT_IMAGE) && HAS_PERSISTENCE(img_report) && persistence_size) {
if ((props->is_grub_cfg) || (props->is_menu_cfg) || (props->is_syslinux_cfg)) {
// Ubuntu & derivatives are assumed to use '/casper/vmlinuz'
// in their kernel options and use 'persistent' as keyword.
// Ubuntu & derivatives are assumed to use 'file=/cdrom/preseed/...'
// somewhere in their kernel options and use 'persistent' as keyword.
if (replace_in_token_data(src, props->is_grub_cfg ? "linux" : "append",
props->is_grub_cfg ? "/casper/vmlinuz" : "initrd=/casper/initrd",
// Of course, Mint has to use 'initrd=/casper/initrd.lz' instead of 'initrd=/casper/initrd'
props->is_grub_cfg ? "/casper/vmlinuz persistent" : "persistent initrd=/casper/initrd", TRUE) != NULL)
"file=/cdrom/preseed", "persistent file=/cdrom/preseed", TRUE) != NULL)
uprintf(" Added 'persistent' kernel option");
// Debian & derivatives are assumed to use 'boot=live' in
// their kernel options and use 'persistence' as keyword.