Displaying 20 results from an estimated 41 matches for "grub_config".
2020 May 15
1
[PATCH] v2v: fix UEFI bootloader for linux guests
..._suffix =
+ if contains arch "x86_64" then "X64"
+ else if contains arch "x86_32" then "X32"
+ else "" in
+ arch_suffix
+
+(* Function fixes uefi boot. It's used in both cases: legacy grub and grub2 *)
+let fix_uefi g distro distro_ver grub_config arch =
+ let cant_fix_uefi () = (
+ info (f_"Can't fix UEFI bootloader. VM may not boot.");
+ "" ) in
+
+ let file_exists file =
+ if g#exists file then
+ true
+ else (
+ info (f_"Can't find file: '%s' needed for UEFI...
2016 Aug 15
2
[PATCH v2] v2v: factor out bootloader handling
...b2
+
+(* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
+let remove_hd_prefix path =
+ let rex = Str.regexp "^(hd.*)\\(.*\\)" in
+ Str.replace_first rex "\\1" path
+
+(* Grub1 (AKA grub-legacy) representation. *)
+class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ (* Grub prefix? Usually "/boot". *)
+ let grub_prefix =
+ let mounts = g#inspect_get_mountpoints inspect.i_root in
+ try
+ List.find (
+ fun path -> List.mem_assoc path mounts
+ ) [ "/boot/grub"; "/boot" ]
+ with Not_found -> &quo...
2016 Aug 15
0
Re: [PATCH v2] v2v: factor out bootloader handling
...USE: remove (hdX,X) prefix from a path. *)
> +let remove_hd_prefix path =
> + let rex = Str.regexp "^(hd.*)\\(.*\\)" in
> + Str.replace_first rex "\\1" path
> +
> +(* Grub1 (AKA grub-legacy) representation. *)
> +class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> + (* Grub prefix? Usually "/boot". *)
> + let grub_prefix =
> + let mounts = g#inspect_get_mountpoints inspect.i_root in
> + try
> + List.find (
> + fun path -> List.mem_assoc path mounts
> + ) [ "/boot/grub"; "/boot&quo...
2015 Nov 20
0
[PATCH] v2v: factor out bootloader handling
...Grub1
+ | Grub2
+
+(* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
+let remove_hd_prefix path =
+ let rex = Str.regexp "^(hd.*)\\(.*\\)" in
+ Str.replace_first rex "\\1" path
+
+(* Grub1 (AKA grub-legacy) representation. *)
+class bootloader_grub1 g inspect grub_config =
+ let prefix =
+ let mounts = g#inspect_get_mountpoints inspect.i_root in
+ try
+ List.find (
+ fun path -> List.mem_assoc path mounts
+ ) [ "/boot/grub"; "/boot" ]
+ with Not_found -> "" in
+object
+ inherit bootloader
+
+ method n...
2016 Aug 25
2
[PATCH v2] v2v: factor out bootloader handling
...vert_linux.ml
@@ -87,45 +87,9 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
(* Clean RPM database. This must be done early to avoid RHBZ#1143866. *)
Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?");
- (* What grub is installed? *)
- let grub_config, grub =
- let locations = [
- "/boot/grub2/grub.cfg", `Grub2;
- "/boot/grub/menu.lst", `Grub1;
- "/boot/grub/grub.conf", `Grub1;
- ] in
- let locations =
- match inspect.i_firmware with
- | I_UEFI _ ->
- [
- "/b...
2016 Nov 02
4
[PATCH v4 1/2] v2v: bootloaders: search grub config for all distributions
...;
+
(* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
let remove_hd_prefix path =
let rex = Str.regexp "^(hd.*)\\(.*\\)" in
@@ -49,6 +53,10 @@ let remove_hd_prefix path =
(* Grub1 (AKA grub-legacy) representation. *)
class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ let () =
+ if grub_config = "/boot/efi/EFI/redhat/grub.conf" then
+ g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf" in
+
(* Grub prefix? Usually "/boot". *)
let grub_prefix =
let mounts = g#inspect_get_mountpoints inspect.i_ro...
2016 Nov 01
3
[PATCH v3] v2v: bootloaders: search grub config for all distributions
...iff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index e03d22b..0c236e1 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -49,6 +49,14 @@ let remove_hd_prefix path =
(* Grub1 (AKA grub-legacy) representation. *)
class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ (* We expect Augeas to parse the grub_config file. However
+ * the upstream lens only lists a subset of the possible
+ * locations for this file. Therefore tell Augeas that
+ * grub_config is a grub file (this apparently doesn't affect
+ * Augeas if it already parsed the file).
+...
2016 Sep 13
1
[PATCH v3 2/2] v2v: ilnux: detect name of grub2-mkconfig
...ile changed, 15 insertions(+), 2 deletions(-)
diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index a5e4c8d..4f53f87 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -186,6 +186,19 @@ end
(* Grub2 representation. *)
class bootloader_grub2 (g : G.guestfs) grub_config =
+
+ let grub2_mkconfig_cmd =
+ let elems = [
+ "/sbin/grub2-mkconfig";
+ "/usr/sbin/grub2-mkconfig";
+ "/sbin/grub-mkconfig";
+ "/usr/sbin/grub-mkconfig"
+ ] in
+ try List.find (g#is_file ~followsymlinks:true) elems
+...
2017 Apr 28
0
Re: [PATCH v6 1/1] v2v: bootloaders: search grub config for all distributions
...> let remove_hd_prefix path =
> >> let rex = Str.regexp "^(hd.*)\\(.*\\)" in
> >>@@ -49,6 +53,13 @@ let remove_hd_prefix path =
> >>
> >> (* Grub1 (AKA grub-legacy) representation. *)
> >> class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> >>+ let () =
> >
> >Wrong indentation here.
> >
> >>+ (* Apply the "grub" lens if it is not handling the file
> >>+ * already -- Augeas < 1.7.0 will error out otherwise.
> >>+ *)
> >>+ if g#aug_ls (&quo...
2016 Sep 12
2
[PATCH 2/2] v2v: ilnux: detect name of grub2-mkconfig
...rs.ml | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index a5e4c8d..0729f17 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -189,6 +189,22 @@ class bootloader_grub2 (g : G.guestfs) grub_config =
object (self)
inherit bootloader
+ method private grub2_mkconfig_cmd =
+ let elems = [
+ "/sbin/grub2-mkconfig";
+ "/usr/sbin/grub2-mkconfig";
+ "/sbin/grub-mkconfig"
+ "/usr/sbin/grub-mkconfig"
+ ] in
+ try
+...
2017 Apr 28
0
Re: [PATCH v6 1/1] v2v: bootloaders: search grub config for all distributions
...SE: remove (hdX,X) prefix from a path. *)
> let remove_hd_prefix path =
> let rex = Str.regexp "^(hd.*)\\(.*\\)" in
> @@ -49,6 +53,13 @@ let remove_hd_prefix path =
>
> (* Grub1 (AKA grub-legacy) representation. *)
> class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> + let () =
Wrong indentation here.
> + (* Apply the "grub" lens if it is not handling the file
> + * already -- Augeas < 1.7.0 will error out otherwise.
> + *)
> + if g#aug_ls ("/files" ^ grub_config) = [||] then
> + g#aug_transfo...
2016 Nov 01
0
Re: [PATCH v3] v2v: bootloaders: search grub config for all distributions
...l b/v2v/linux_bootloaders.ml
> index e03d22b..0c236e1 100644
> --- a/v2v/linux_bootloaders.ml
> +++ b/v2v/linux_bootloaders.ml
> @@ -49,6 +49,14 @@ let remove_hd_prefix path =
>
> (* Grub1 (AKA grub-legacy) representation. *)
> class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> + (* We expect Augeas to parse the grub_config file. However
> + * the upstream lens only lists a subset of the possible
> + * locations for this file. Therefore tell Augeas that
> + * grub_config is a grub file (this apparently doesn't affect
> + * Augeas if it al...
2016 Nov 10
0
[PATCH v5 1/3] v2v: bootloaders: search grub config for all distributions
...;
+
(* Helper function for SUSE: remove (hdX,X) prefix from a path. *)
let remove_hd_prefix path =
let rex = Str.regexp "^(hd.*)\\(.*\\)" in
@@ -49,6 +53,10 @@ let remove_hd_prefix path =
(* Grub1 (AKA grub-legacy) representation. *)
class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ let () =
+ if grub_config = "/boot/efi/EFI/redhat/grub.conf" then
+ g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf" in
+
(* Grub prefix? Usually "/boot". *)
let grub_prefix =
let mounts = g#inspect_get_mountpoints inspect.i_ro...
2020 Jul 24
3
[PATCH v2] v2v: fix UEFI bootloader for linux guests
...uot; uefi_fallback_path suffix in
+
+ let file_exists file =
+ if g#exists file then
+ true
+ else (
+ info (f_"Can't find file: '%s' needed for UEFI fixing")
+ file;
+ false )
+ in
+
+ let grub_config = bootloader#get_config_file () in
+
+ let grub_path =
+ String.sub grub_config 0 (String.rindex grub_config '/') in
+
+ if g#exists uefi_fallback_name then
+ (* don't do anything if uefi fallback exists *)
+ ()
+ else (
+ info (f...
2017 May 02
2
[PATCH] v2v: bootloaders: search grub config for all distributions
...--git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
index cad72a829..33a6dc4e9 100644
--- a/v2v/linux_bootloaders.ml
+++ b/v2v/linux_bootloaders.ml
@@ -49,6 +49,13 @@ let remove_hd_prefix path =
(* Grub1 (AKA grub-legacy) representation. *)
class bootloader_grub1 (g : G.guestfs) inspect grub_config =
+ let () =
+ (* Apply the "grub" lens if it is not handling the file
+ * already -- Augeas < 1.7.0 will error out otherwise.
+ *)
+ if g#aug_ls ("/files" ^ grub_config) = [||] then
+ g#aug_transform "grub" grub_config in
+
(* Grub prefix? Usually &qu...
2016 Nov 10
5
[PATCH v5 0/3] v2v and augeas
Augeas 1.7.0 was released a couple of days ago. By encouraging
everyone to upgrade to this we can drop several calls to aug_transform
and also our custom copies of two lenses, and a lot of related code.
Rich.
2016 Sep 12
0
Re: [PATCH 2/2] v2v: ilnux: detect name of grub2-mkconfig
...; 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/v2v/linux_bootloaders.ml b/v2v/linux_bootloaders.ml
> index a5e4c8d..0729f17 100644
> --- a/v2v/linux_bootloaders.ml
> +++ b/v2v/linux_bootloaders.ml
> @@ -189,6 +189,22 @@ class bootloader_grub2 (g : G.guestfs) grub_config =
> object (self)
> inherit bootloader
>
> + method private grub2_mkconfig_cmd =
I'd make it a simple attribute of the object, just like grub_prefix in
class bootloader_grub1.
> + let elems = [
> + "/sbin/grub2-mkconfig";
> + "/usr/sbi...
2016 Aug 10
3
[PATCH 2/2] v2v: ilnux: detect name of grub2-mkconfig
...Grub prefix? Usually "/boot". *)
let grub_prefix =
match grub with
@@ -1109,7 +1126,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
g#aug_save ();
try
- ignore (g#command [| "grub2-mkconfig"; "-o"; grub_config |])
+ ignore (g#command [| grub2_mkconfig_cmd; "-o"; grub_config |])
with
G.Error msg ->
warning (f_"could not rebuild grub2 configuration file (%s). This may mean that grub output will not be sent to the serial port, but otherwise should...
2016 Nov 02
0
Re: [PATCH v4 1/2] v2v: bootloaders: search grub config for all distributions
...sykin <pbutsykin@virtuozzo.com>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
Mostly LGTM (it was the approach I suggested, after all) -- just one
note below.
> (* Grub1 (AKA grub-legacy) representation. *)
> class bootloader_grub1 (g : G.guestfs) inspect grub_config =
> + let () =
> + if grub_config = "/boot/efi/EFI/redhat/grub.conf" then
> + g#aug_transform "grub" "/boot/efi/EFI/redhat/grub.conf" in
I guess this could be changed to be:
if String.is_prefix grub_config "/boot/efi/EFI/" then
g#aug...
2020 Aug 27
2
Re: Weird results from g.sh()
...# a weak uefi detection algorithm which doesn't work from a chrooted
# environment (checks for [ -d /sys/firmware/efi ])
if (self.root.family, self.boot_type) != (LinuxFamily.RHEL,
BootType.UEFI):
return
grub_config = g.read_file(self.config).decode('utf-8')
write = False
for old, new in [('linux16', 'linuxefi'),
('initrd16', 'initrdefi')]:
if f'\t{old} ' in grub_config:
debug(f'Replacing {o...