grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] grub-mkrescue: remove temporary load_cfg file
@ 2014-05-01 16:16 Andrey Borzenkov
  2014-09-21 17:08 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Borzenkov @ 2014-05-01 16:16 UTC (permalink / raw)
  To: grub-devel

---
 util/grub-mkrescue.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
index e719839..c3d9b32 100644
--- a/util/grub-mkrescue.c
+++ b/util/grub-mkrescue.c
@@ -323,6 +323,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 ();
+  grub_util_unlink (load_cfg);
 }
 
 static int
@@ -566,6 +567,7 @@ main (int argc, char *argv[])
 	}
       grub_install_pop_module ();
       grub_install_pop_module ();
+      grub_util_unlink (load_cfg);
     }
 
   /** build multiboot core.img */
-- 
tg: (4b8b913..) u/load_cfg (depends on: master)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] grub-mkrescue: remove temporary load_cfg file
  2014-05-01 16:16 [PATCH] grub-mkrescue: remove temporary load_cfg file Andrey Borzenkov
@ 2014-09-21 17:08 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-22 18:32   ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-09-21 17:08 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

I actually like to have load.cfg around: it helps with debugging in some
cases. Do you have a reason to remove it?
On 01.05.2014 18:16, Andrey Borzenkov wrote:
> ---
>  util/grub-mkrescue.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
> index e719839..c3d9b32 100644
> --- a/util/grub-mkrescue.c
> +++ b/util/grub-mkrescue.c
> @@ -323,6 +323,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 ();
> +  grub_util_unlink (load_cfg);
>  }
>  
>  static int
> @@ -566,6 +567,7 @@ main (int argc, char *argv[])
>  	}
>        grub_install_pop_module ();
>        grub_install_pop_module ();
> +      grub_util_unlink (load_cfg);
>      }
>  
>    /** build multiboot core.img */
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] grub-mkrescue: remove temporary load_cfg file
  2014-09-21 17:08 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2014-09-22 18:32   ` Andrei Borzenkov
  0 siblings, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2014-09-22 18:32 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]

В Sun, 21 Sep 2014 19:08:45 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <phcoder@gmail.com> пишет:

> 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 */

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-22 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-01 16:16 [PATCH] grub-mkrescue: remove temporary load_cfg file Andrey Borzenkov
2014-09-21 17:08 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-22 18:32   ` Andrei Borzenkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).