[rear-devel] [rear/rear] fae98b: Move partition->device translation into a function

Johannes Meixner noreply at github.com
Wed May 5 14:35:15 CEST 2021


  Branch: refs/heads/master
  Home:   https://github.com/rear/rear
  Commit: fae98be14d0a7de30128f896c879f19259a96ad7
      https://github.com/rear/rear/commit/fae98be14d0a7de30128f896c879f19259a96ad7
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
    M usr/share/rear/lib/layout-functions.sh

  Log Message:
  -----------
  Move partition->device translation into a function

The new function is called get_device_from_partition() and resides in
layout-functions.sh.

Also change variable names to conform to ReaR coding style:
local variables should be all lowercase.

Another place that could make use of the new function is
usr/share/rear/finalize/Linux-i386/610_EFISTUB_run_efibootmgr.sh


  Commit: 3af8872ecdf0d758403174fabbd6e34a27d2fe2d
      https://github.com/rear/rear/commit/3af8872ecdf0d758403174fabbd6e34a27d2fe2d
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Use filesystem_name() instead of a homegrown code


  Commit: 99ea2a9665220f12b29402f416ed09696bc4fd5c
      https://github.com/rear/rear/commit/99ea2a9665220f12b29402f416ed09696bc4fd5c
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Add logging if having to use the fallback for ESP


  Commit: 585c89660cfd9217827370025d6313007a3c62ca
      https://github.com/rear/rear/commit/585c89660cfd9217827370025d6313007a3c62ca
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/lib/layout-functions.sh

  Log Message:
  -----------
  Teach get_child_components() to skip device types

Sometimes not all ancestors of a given filesystem are desired.

If we want to install a bootloader on a disk containing /boot,
we need to locate the partition that /boot resides on. We do that using
layout dependencies.
Unfortunately, dependencies also include dependencies between
filesystems: a filesystem depends on filesystems that contain its
mountpoint. We are not interested in this kind of dependencies,
otherwise we end up installing the bootloader on the disk containing the
root filesystem (if different from the /boot disk).

In order to solve this, add an optional argument to
the get_child_components() and the find_*() functions in
layout-functions.sh. It is a list of dependency types that should be
ignored when traversing the dependency tree. Unlike the second argument
to get_child_components(), it affects not only the final results but
also the intermediate tree nodes.

In order to solve the problem above, this argument can be set to "fs"
and dependencies between filesystems will be ignored.


  Commit: 32a3b96a922a353fc81159594d5ac1a2837a5119
      https://github.com/rear/rear/commit/32a3b96a922a353fc81159594d5ac1a2837a5119
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Use dependencies when determining partitions for UEFI

The ESP may be located on a RAID device. In this case, we need to
determine the physical RAID components and call efibootmgr on them,
because efibootmgr does not know how to tell the firmware to boot from
RAID. Moreover, the current code tries to parse a device like /dev/md125
into a disk called /dev/md and partition 125.

Fix by using storage dependencies: RAID components (the actual ESP
copies) can be found as dependencies of the ESP block device. For
consistency, use dependencies also to locate the ESP block device itself
(the old method is preserved as a fallback).  Similar strategy is used
by the GRUB2 installation code
(finalize/Linux-i386/660_install_grub2.sh), which is able to install
GRUB2 on the RAID components correctly.

Remove a comment that has been obsolete since revision
bf6742bec5181ad7987a4a705668cc1a3834bef4 (partition numbers can have
more digits now).

TODO: finalize/Linux-i386/610_EFISTUB_run_efibootmgr.sh needs a similar
fix.

Fixes #2595


  Commit: 2efa85db64898c0a8a32828d1ff88483b4acbb35
      https://github.com/rear/rear/commit/2efa85db64898c0a8a32828d1ff88483b4acbb35
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Add a LogPrint before EFI operations

Sets the context for possible subsequent messages that get logged if
something goes wrong or at least suspect.

This is similar to what finalize/Linux-i386/660_install_grub2.sh does.


  Commit: d764184c02aa950b926df981dc8735c6c19fb588
      https://github.com/rear/rear/commit/d764184c02aa950b926df981dc8735c6c19fb588
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Apply style guidelines to local variable names


  Commit: 27de4cd95dabe86f531f132108744459b2dbcfd0
      https://github.com/rear/rear/commit/27de4cd95dabe86f531f132108744459b2dbcfd0
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Declare local variables


  Commit: 3e63ccf30511e48327157b360c7bc6cc703d90fd
      https://github.com/rear/rear/commit/3e63ccf30511e48327157b360c7bc6cc703d90fd
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Report if ESP mountpoint is not found

The main part of the script gets skipped in this case, which is likely
a problem and should be reported. Also, we have said before that we are
"Creating EFI Boot Manager entries...", so we have to report when it
actually does not happen.


  Commit: 0a40d9ecef4a322dee350ea4c170c3fa699d638b
      https://github.com/rear/rear/commit/0a40d9ecef4a322dee350ea4c170c3fa699d638b
  Author: Pavel Cahyna <pcahyna at redhat.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
    M usr/share/rear/lib/layout-functions.sh

  Log Message:
  -----------
  Add checks for encountering invalid device

get_device_from_partition() now validates the input partition and the
converted output (disk/device name). 670_run_efibootmgr.sh now checks
for possible errors from get_device_from_partition() and logs them.


  Commit: 2c76d0eb47c87335a1781df344e965d2afe09196
      https://github.com/rear/rear/commit/2c76d0eb47c87335a1781df344e965d2afe09196
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Update 670_run_efibootmgr.sh

Have the LogPrint "Creating EFI Boot Manager entries..." user message
before the first LogPrintError "Failed to create EFI Boot Manager entries ..."
cf. https://github.com/rear/rear/pull/2608#discussion_r622968771


  Commit: c21bd679fa96b4a22bce02871a645c3da5aa2c84
      https://github.com/rear/rear/commit/c21bd679fa96b4a22bce02871a645c3da5aa2c84
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Update 670_run_efibootmgr.sh

Explain why having no "$TARGET_FS_ROOT/$UEFI_BOOTLOADER"
conflicts with USING_UEFI_BOOTLOADER is true
i.e. we should create EFI Boot Manager entries but we cannot
so we report it as LogPrintError to the user.


  Commit: 3472863182d83213e7bf5dd13ffa3d144e6e151c
      https://github.com/rear/rear/commit/3472863182d83213e7bf5dd13ffa3d144e6e151c
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Update 670_run_efibootmgr.sh

Use LogPrintError "... UEFI bootloader '$UEFI_BOOTLOADER' not found..."
(i.e. with single quotes) because UEFI_BOOTLOADER might be empty and
then this is visible in the message as "... UEFI bootloader '' not found..."


  Commit: 9af7b79792f86ec995dab892dec0faf145f45529
      https://github.com/rear/rear/commit/9af7b79792f86ec995dab892dec0faf145f45529
  Author: Johannes Meixner <jsmeix at suse.de>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh

  Log Message:
  -----------
  Update 670_run_efibootmgr.sh

Leave 940_grub2_rescue.sh at the end with explicit "return 1" in case of
LogPrintError "efibootmgr failed to create EFI Boot Manager entry ..."
cf. same kind of code in finalize/Linux-i386/660_install_grub2.sh


  Commit: 4f7903adb2bd174b88c767a51837872cefc6ba53
      https://github.com/rear/rear/commit/4f7903adb2bd174b88c767a51837872cefc6ba53
  Author: Johannes Meixner <jsmeix at suse.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M usr/share/rear/finalize/Linux-i386/670_run_efibootmgr.sh
    M usr/share/rear/lib/layout-functions.sh

  Log Message:
  -----------
  Merge pull request #2608 from pcahyna/fix-uefi-on-raid

Fix setting boot path in case of UEFI partition (ESP) on MD RAID:
The code finalize/Linux-i386/670_run_efibootmgr.sh did not support Software RAID.
It has to execute the efibootmgr command on the members of the Software RAID,
see https://github.com/rear/rear/issues/2595
The ESP may be located on a RAID device. In this case, we need to determine
the physical RAID components and call efibootmgr on them.
In addition, clean up finalize/Linux-i386/670_run_efibootmgr.sh
and add more logging to ease analysis when something goes wrong,
see https://github.com/rear/rear/pull/2608


Compare: https://github.com/rear/rear/compare/ec7fb6d3be13...4f7903adb2bd


More information about the rear-devel mailing list