[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grub-mkrescue: remove temporary load_cfg file
From: |
Andrei Borzenkov |
Subject: |
Re: [PATCH] grub-mkrescue: remove temporary load_cfg file |
Date: |
Mon, 22 Sep 2014 22:32:07 +0400 |
В Sun, 21 Sep 2014 19:08:45 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <address@hidden> пишет:
> I actually like to have load.cfg around: it helps with debugging in some
> cases. Do you have a reason to remove it?
On general principles that program has to cleanup after itself unless
asked otherwise. load_cfg was already removed in one code path there so
I considered it a cleanup. Also I have dozens of temporary files with
cryptic names created by grub in /tmp, I'd have hard time matching them.
What about patch below? It saves load.cfg in target directory on image.
This matches what grub-install does and lets you see load.cfg even if
image is copied elsewhere.
diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
index e719839..4121f61 100644
--- a/util/grub-mkrescue.c
+++ b/util/grub-mkrescue.c
@@ -270,7 +270,9 @@ make_image_abs (enum grub_install_plat plat,
grub_util_info (N_("enabling %s support ..."),
mkimage_target);
- load_cfg = grub_util_make_temporary_file ();
+ load_cfg = grub_util_path_concat (3, boot_grub,
+ grub_install_get_platform_name (plat),
+ "load.cfg");
load_cfg_f = grub_util_fopen (load_cfg, "wb");
fprintf (load_cfg_f, "search --fs-uuid --set=root %s\n", iso_uuid);
@@ -286,7 +288,7 @@ make_image_abs (enum grub_install_plat plat,
mkimage_target, 0);
grub_install_pop_module ();
grub_install_pop_module ();
- grub_util_unlink (load_cfg);
+ free (load_cfg);
}
static void
@@ -313,7 +315,9 @@ make_image_fwdisk_abs (enum grub_install_plat plat,
grub_util_info (N_("enabling %s support ..."),
mkimage_target);
- load_cfg = grub_util_make_temporary_file ();
+ load_cfg = grub_util_path_concat (3, boot_grub,
+ grub_install_get_platform_name (plat),
+ "load.cfg");
load_cfg_f = grub_util_fopen (load_cfg, "wb");
write_part (load_cfg_f, source_dirs[plat]);
@@ -323,6 +327,7 @@ make_image_fwdisk_abs (enum grub_install_plat plat,
grub_install_make_image_wrap (source_dirs[plat], "()/boot/grub", output,
0, load_cfg, mkimage_target, 0);
grub_install_pop_module ();
+ free (load_cfg);
}
static int
@@ -491,7 +496,7 @@ main (int argc, char *argv[])
char *load_cfg;
FILE *load_cfg_f;
char *output = grub_util_path_concat (3, boot_grub, "i386-pc",
"eltorito.img");
- load_cfg = grub_util_make_temporary_file ();
+ load_cfg = grub_util_path_concat (3, boot_grub, "i386-pc", "load.cfg");
grub_util_info (N_("enabling %s support ..."), "BIOS");
load_cfg_f = grub_util_fopen (load_cfg, "wb");
@@ -566,6 +571,7 @@ main (int argc, char *argv[])
}
grub_install_pop_module ();
grub_install_pop_module ();
+ free (load_cfg);
}
/** build multiboot core.img */
signature.asc
Description: PGP signature