gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / grub-efi-fat-serial-number.patch
1 Change 'grub-mkrescue' to honor the 'GRUB_FAT_SERIAL_NUMBER'
2 environment variable. That way, the caller can specify a fixed
3 serial number (instead of the randomly chosen one) to create EFI
4 images (the 'efi.img' file) that are reproducible bit-for-bit.
5
6 Patch by Ludovic Courtès <ludo@gnu.org>.
7 Mangled (for GRUB 2.04) by Tobias Geerinckx-Rice <me@tobias.gr>.
8
9 --- grub-2.04/util/grub-mkrescue.c 2019-05-20 13:01:11.000000000 +0200
10 +++ grub-2.04/util/grub-mkrescue.c 2019-07-08 23:57:36.912104652 +0200
11 @@ -809,8 +809,15 @@
12 free (efidir_efi_boot);
13
14 efiimgfat = grub_util_path_concat (2, iso9660_dir, "efi.img");
15 - rv = grub_util_exec ((const char * []) { "mformat", "-C", "-f", "2880", "-L", "16", "-i",
16 - efiimgfat, "::", NULL });
17 +
18 + const char *fat_serial_number = getenv ("GRUB_FAT_SERIAL_NUMBER");
19 + const char *mformat_args[] =
20 + { "mformat", "-C", "-f", "2880", "-L", "16",
21 + fat_serial_number != NULL ? "-N" : "-C",
22 + fat_serial_number != NULL ? fat_serial_number : "-C",
23 + "-i", efiimgfat, "::", NULL };
24 +
25 + rv = grub_util_exec (mformat_args);
26 if (rv != 0)
27 grub_util_error ("`%s` invocation failed\n", "mformat");
28 rv = grub_util_exec ((const char * []) { "mcopy", "-s", "-i", efiimgfat, efidir_efi, "::/", NULL });