#3354 PR merged: cleanup: move grubby and grub2-editenv to 300_include_grub_tools.sh (#3349)

Labels: cleanup, fixed / solved / done

gdha opened issue at 2024-12-04 13:24:

Pull Request Details:
  • Type: Cleanup

  • Impact: Low

  • Reference to related issue (URL): #3349
    PS: this PR replaces PR-3352

  • How was this pull request tested? manually

  • Description of the changes in this pull request: grubby and grub2-editenv were added by PR #3349 into the conf/GNU/Linux.conf file in the PROGS section. However, it seems proper to move these 2 programs to the prep/GNU/Linux/300_include_grub_tools.sh script.

jsmeix commented at 2024-12-05 08:05:

usr/share/rear/prep/GNU/Linux/300_include_grub_tools.sh
does not tell why it exists at all, see
https://github.com/rear/rear/pull/3352#issuecomment-2514232463

I.e. what the reason is why GRUB tools are needed within
the recovery system regardless that during "rear recover"
GRUB is installed within the recreated target system
via chroot into the recreated target system.

According to
https://github.com/rear/rear/pull/3352#discussion_r1867492931
and
https://github.com/rear/rear/pull/3352#discussion_r1867916286
the reason why
usr/share/rear/prep/GNU/Linux/300_include_grub_tools.sh
exists is not for "rear recover" but for a different use case
which is using the ReaR recovery system to repair the system,
in particular to repair GRUB on the original system
(e.g. because the original system fails to boot).

So
usr/share/rear/prep/GNU/Linux/300_include_grub_tools.sh
should be enhanced with an initial comment that
explains why it it exists at all for example like

# GRUB tools are not required inside the recovery system
# for "rear recover" because during "rear recover"
# GRUB is installed within the recreated target system
# via chroot into the recreated target system.
# Nevertheless GRUB tools are useful inside the
# recovery system for a different use case which is
# using the ReaR recovery system to repair the system,
# in particular to repair GRUB on the original system
# when the original system fails to boot.

jsmeix commented at 2024-12-05 08:53:

Via
https://github.com/rear/rear/commit/2478b4cf9100e77d28c414591e2ec6b330851b49
I explained in prep/GNU/Linux/300_include_grub_tools.sh
why it exists at all.

My above assumption that GRUB tools are not needed within
the ReaR recovery system because during "rear recover"
GRUB is installed within the recreated target system
via chroot into the recreated target system
is not true because

# There is one exception for GRUB2: grub-probe or grub2-probe
# This is required inside the recovery system because the function
# is_grub2_installed is also called during "rear recover"
# in finalize/Linux-i386/630_install_grub.sh
# and finalize/Linux-i386/660_install_grub2.sh
# And 'type -p grub-probe || type -p grub2-probe' is called during "rear recover"
# in finalize/Linux-ppc64le/660_install_grub2.sh
# and finalize/SUSE_LINUX/s390/660_install_grub2_and_zipl.sh
# Other code places that call 'has_binary grub-probe' or 'has_binary grub2-probe'
# are not run during "rear recover"
# (at least as far as I <jsmeix@suse.de> found out up to now dated 05 Dec. 2024)

[Export of Github issue for rear/rear.]