[elbe-devel] [PATCH v2 3/4] grubinstaller: mount all labels

bage at linutronix.de bage at linutronix.de
Fri Aug 23 11:03:31 CEST 2019


From: Bastian Germann <bage at linutronix.de>

This adapts the Jan 2018 patch (without grub 1.99 part and the dot
in mountpoints) by John with the following original commit message:

The current grub installation implementation assumes that all files
needed to install grub are located in / and /boot partitions.
However, the user may specify other partitions (such as /usr) that
are also needed when installing grub.

Instead of handling /boot as a special case, store all non-root
labels and mount all of them when installing grub.

Signed-off-by: John Ogness <john.ogness at linutronix.de>
Signed-off-by: Bastian Germann <bage at linutronix.de>
---
 elbepack/hdimg.py | 38 ++++++++++----------------------------
 1 file changed, 10 insertions(+), 28 deletions(-)

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 29dd132e..af278ee4 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -147,16 +147,11 @@ class grubinstaller_base(object):
     def __init__(self, outf, fw_type=[]):
         self.outf = outf
         self.root = None
-        self.boot = None
-        self.boot_efi = None
+        self.fs = []
         self.fw_type = fw_type
 
-    def set_boot_entry(self, entry):
-        print("setting boot entry")
-        self.boot = entry
-
-    def set_boot_efi_entry(self, entry):
-        self.boot_efi = entry
+    def add_fs_entry(self, entry):
+        self.fs.append(entry)
 
     def set_root_entry(self, entry):
         self.root = entry
@@ -181,17 +176,11 @@ class grubinstaller202(grubinstaller_base):
                 'mount /dev/mapper/poop0p%d %s' %
                 (self.root.partnum, imagemnt))
 
-            if self.boot:
-                self.outf.do(
-                    'mount /dev/mapper/poop0p%d %s' %
-                    (self.boot.partnum, os.path.join(
-                        imagemnt, "boot")))
-
-            if self.boot_efi:
+            for entry in self.fs:
                 self.outf.do(
                     'mount /dev/mapper/poop0p%d %s' %
-                    (self.boot_efi.partnum, os.path.join(
-                        imagemnt, "boot/efi")))
+                    (entry.partnum, os.path.join(
+                        imagemnt, entry.mountpoint)))
 
             self.outf.do(
                 "mount --bind /dev %s" %
@@ -259,15 +248,10 @@ class grubinstaller202(grubinstaller_base):
                     "sys"),
                 allow_fail=True)
 
-            if self.boot_efi:
+            for entry in self.fs:
                 self.outf.do(
                     'umount /dev/mapper/poop0p%d' %
-                    self.boot_efi.partnum, allow_fail=True)
-
-            if self.boot:
-                self.outf.do(
-                    'umount /dev/mapper/poop0p%d' %
-                    self.boot.partnum, allow_fail=True)
+                    entry.partnum, allow_fail=True)
 
             self.outf.do(
                 'umount /dev/mapper/poop0p%d' %
@@ -333,10 +317,8 @@ def create_label(outf, disk, part, ppart, fslabel, target, grub):
 
     if entry.mountpoint == "/":
         grub.set_root_entry(entry)
-    elif entry.mountpoint == "/boot":
-        grub.set_boot_entry(entry)
-    elif entry.mountpoint == "/boot/efi":
-        grub.set_boot_efi_entry(entry)
+    else:
+        grub.add_fs_entry(entry)
 
     entry.losetup(outf, "loop0")
     outf.do(
-- 
2.20.1




More information about the elbe-devel mailing list