|
|
fbcaed |
From 9277b3b38557cbdb60abe06af93513ebcb0038c9 Mon Sep 17 00:00:00 2001
|
|
|
fbcaed |
From: Colin Walters <walters@verbum.org>
|
|
|
fbcaed |
Date: Mon, 13 Oct 2014 21:01:23 -0400
|
|
|
fbcaed |
Subject: [PATCH 1/5] Handle the case of rpmostreepayload + GRUB2
|
|
|
fbcaed |
|
|
|
fbcaed |
NOTE: Incompatible change for trees constructed prior to
|
|
|
fbcaed |
NOTE: https://github.com/projectatomic/rpm-ostree/pull/35
|
|
|
fbcaed |
|
|
|
fbcaed |
For rpmostreepayload (in contrast to yum mainline) is that Anaconda
|
|
|
fbcaed |
lays down the bootloader data and computes the kernel arguments, but
|
|
|
fbcaed |
ostree takes care of writing the configuration file (as it does on
|
|
|
fbcaed |
upgrades as well).
|
|
|
fbcaed |
|
|
|
fbcaed |
However, the handling of /boot in OSTree was a bit broken, and trying
|
|
|
fbcaed |
to support GRUB2 forced this change, because we need to ultimately
|
|
|
fbcaed |
execute grub2-mkconfig in the chroot and we need both the *real* /boot
|
|
|
fbcaed |
as well as the new /usr/lib/ostree-boot.
|
|
|
fbcaed |
|
|
|
fbcaed |
We switch to keeping /boot in the target root, and call ostree from
|
|
|
fbcaed |
there. This should still work for extlinux because we're just
|
|
|
fbcaed |
rewriting a config file.
|
|
|
fbcaed |
|
|
|
fbcaed |
For moving the GRUB2 config file, see a similar change for
|
|
|
fbcaed |
rpmostreepayload+extlinux in commit: 627486c22cdaf6c07009026791f5bd6fc1aaadaa
|
|
|
fbcaed |
|
|
|
fbcaed |
Note: This commit is only useful on BIOS systems as of yet.
|
|
|
fbcaed |
|
|
|
fbcaed |
Conflicts:
|
|
|
fbcaed |
pyanaconda/bootloader.py
|
|
|
fbcaed |
pyanaconda/install.py
|
|
|
fbcaed |
pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
---
|
|
|
fbcaed |
pyanaconda/bootloader.py | 11 ++++----
|
|
|
fbcaed |
pyanaconda/install.py | 14 ----------
|
|
|
fbcaed |
pyanaconda/packaging/rpmostreepayload.py | 48 +++++++++++++++-----------------
|
|
|
fbcaed |
3 files changed, 28 insertions(+), 45 deletions(-)
|
|
|
fbcaed |
|
|
|
fbcaed |
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
|
|
|
fbcaed |
index 6c693db..29004b1 100644
|
|
|
fbcaed |
--- a/pyanaconda/bootloader.py
|
|
|
fbcaed |
+++ b/pyanaconda/bootloader.py
|
|
|
fbcaed |
@@ -1551,11 +1551,12 @@ class GRUB2(GRUB):
|
|
|
fbcaed |
log.error("bootloader password setup failed: %s" % e)
|
|
|
fbcaed |
|
|
|
fbcaed |
# make sure the default entry is the OS we are installing
|
|
|
fbcaed |
- entry_title = "%s Linux, with Linux %s" % (productName,
|
|
|
fbcaed |
- self.default.version)
|
|
|
fbcaed |
- rc = iutil.execInSysroot("grub2-set-default", [entry_title])
|
|
|
fbcaed |
- if rc:
|
|
|
fbcaed |
- log.error("failed to set default menu entry to %s" % productName)
|
|
|
fbcaed |
+ if self.default is not None:
|
|
|
fbcaed |
+ entry_title = "%s Linux, with Linux %s" % (productName,
|
|
|
fbcaed |
+ self.default.version)
|
|
|
fbcaed |
+ rc = iutil.execInSysroot("grub2-set-default", [entry_title])
|
|
|
fbcaed |
+ if rc:
|
|
|
fbcaed |
+ log.error("failed to set default menu entry to %s" % productName)
|
|
|
fbcaed |
|
|
|
fbcaed |
# now tell grub2 to generate the main configuration file
|
|
|
fbcaed |
rc = iutil.execInSysroot("grub2-mkconfig",
|
|
|
fbcaed |
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
|
|
|
fbcaed |
index 959878b..8c90221 100644
|
|
|
fbcaed |
--- a/pyanaconda/install.py
|
|
|
fbcaed |
+++ b/pyanaconda/install.py
|
|
|
fbcaed |
@@ -107,17 +107,6 @@ def doConfiguration(storage, payload, ksdata, instClass):
|
|
|
fbcaed |
|
|
|
fbcaed |
progressQ.send_complete()
|
|
|
fbcaed |
|
|
|
fbcaed |
-def moveBootMntToPhysical(storage):
|
|
|
fbcaed |
- """Move the /boot mount to /mnt/sysimage/boot."""
|
|
|
fbcaed |
- if iutil.getSysroot() == iutil.getTargetPhysicalRoot():
|
|
|
fbcaed |
- return
|
|
|
fbcaed |
- bootmnt = storage.mountpoints.get('/boot')
|
|
|
fbcaed |
- if bootmnt is None:
|
|
|
fbcaed |
- return
|
|
|
fbcaed |
- bootmnt.format.teardown()
|
|
|
fbcaed |
- bootmnt.teardown()
|
|
|
fbcaed |
- bootmnt.format.setup(options=bootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())
|
|
|
fbcaed |
-
|
|
|
fbcaed |
def doInstall(storage, payload, ksdata, instClass):
|
|
|
fbcaed |
"""Perform an installation. This method takes the ksdata as prepared by
|
|
|
fbcaed |
the UI (the first hub, in graphical mode) and applies it to the disk.
|
|
|
fbcaed |
@@ -215,9 +204,6 @@ def doInstall(storage, payload, ksdata, instClass):
|
|
|
fbcaed |
writeBootLoader(storage, payload, instClass, ksdata)
|
|
|
fbcaed |
|
|
|
fbcaed |
with progress_report(_("Performing post-installation setup tasks")):
|
|
|
fbcaed |
- # Now, let's reset the state here so that the payload has
|
|
|
fbcaed |
- # /boot in the system root.
|
|
|
fbcaed |
- moveBootMntToPhysical(storage)
|
|
|
fbcaed |
payload.postInstall()
|
|
|
fbcaed |
|
|
|
fbcaed |
progressQ.send_complete()
|
|
|
fbcaed |
diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
index 8be6d3b..dfb0466 100644
|
|
|
fbcaed |
--- a/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
+++ b/pyanaconda/packaging/rpmostreepayload.py
|
|
|
fbcaed |
@@ -222,40 +222,36 @@ class RPMOSTreePayload(ArchivePayload):
|
|
|
fbcaed |
def postInstall(self):
|
|
|
fbcaed |
super(RPMOSTreePayload, self).postInstall()
|
|
|
fbcaed |
|
|
|
fbcaed |
- physboot = iutil.getTargetPhysicalRoot() + '/boot'
|
|
|
fbcaed |
+ boot = iutil.getSysroot() + '/boot'
|
|
|
fbcaed |
|
|
|
fbcaed |
# If we're using extlinux, rename extlinux.conf to
|
|
|
fbcaed |
# syslinux.cfg, since that's what OSTree knows about.
|
|
|
fbcaed |
# syslinux upstream supports both, but I'd say that upstream
|
|
|
fbcaed |
# using syslinux.cfg is somewhat preferred.
|
|
|
fbcaed |
- physboot_extlinux = physboot + '/extlinux'
|
|
|
fbcaed |
- if os.path.isdir(physboot_extlinux):
|
|
|
fbcaed |
- physboot_syslinux = physboot + '/syslinux'
|
|
|
fbcaed |
- physboot_loader = physboot + '/loader'
|
|
|
fbcaed |
- assert os.path.isdir(physboot_loader)
|
|
|
fbcaed |
- orig_extlinux_conf = physboot_extlinux + '/extlinux.conf'
|
|
|
fbcaed |
- target_syslinux_cfg = physboot_loader + '/syslinux.cfg'
|
|
|
fbcaed |
- log.info("Moving %s -> %s" % (orig_extlinux_conf, target_syslinux_cfg))
|
|
|
fbcaed |
- os.rename(orig_extlinux_conf, target_syslinux_cfg)
|
|
|
fbcaed |
- # A compatibility bit for OSTree
|
|
|
fbcaed |
- os.mkdir(physboot_syslinux)
|
|
|
fbcaed |
- os.symlink('../loader/syslinux.cfg', physboot_syslinux + '/syslinux.cfg')
|
|
|
fbcaed |
- # And *also* tell syslinux that the config is really in /boot/loader
|
|
|
fbcaed |
- os.symlink('loader/syslinux.cfg', physboot + '/syslinux.cfg')
|
|
|
fbcaed |
+ boot_extlinux = boot + '/extlinux'
|
|
|
fbcaed |
+ if os.path.isdir(boot_extlinux):
|
|
|
fbcaed |
+ boot_syslinux = boot + '/syslinux'
|
|
|
fbcaed |
+ boot_loader = boot + '/loader'
|
|
|
fbcaed |
+ orig_extlinux_conf = boot_extlinux + '/extlinux.conf'
|
|
|
fbcaed |
+ target_syslinux_cfg = boot_loader + '/syslinux.cfg'
|
|
|
fbcaed |
+ log.info("Moving %s -> %s", orig_extlinux_conf, target_syslinux_cfg)
|
|
|
fbcaed |
+ os.symlink('loader/syslinux.cfg', boot + '/syslinux.cfg')
|
|
|
fbcaed |
+
|
|
|
fbcaed |
+ # And if we're using GRUB2, move its config file, also with a
|
|
|
fbcaed |
+ # compatibility symlink.
|
|
|
fbcaed |
+ boot_grub2 = boot + '/grub2'
|
|
|
fbcaed |
+ if os.path.isdir(boot_grub2):
|
|
|
fbcaed |
+ boot_loader = boot + '/loader'
|
|
|
fbcaed |
+ orig_grub_cfg = boot_grub2 + '/grub.cfg'
|
|
|
fbcaed |
+ target_grub_cfg = boot_loader + '/grub.cfg'
|
|
|
fbcaed |
+ log.info("Moving %s -> %s", orig_grub_cfg, target_grub_cfg)
|
|
|
fbcaed |
+ os.rename(orig_grub_cfg, target_grub_cfg)
|
|
|
fbcaed |
+ os.symlink('../loader/grub.cfg', orig_grub_cfg)
|
|
|
fbcaed |
|
|
|
fbcaed |
# OSTree owns the bootloader configuration, so here we give it
|
|
|
fbcaed |
# the argument list we computed from storage, architecture and
|
|
|
fbcaed |
# such.
|
|
|
fbcaed |
- set_kargs_args = ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
|
fbcaed |
- "instutil", "set-kargs"]
|
|
|
fbcaed |
+ set_kargs_args = ["admin", "instutil", "set-kargs"]
|
|
|
fbcaed |
set_kargs_args.extend(self.storage.bootloader.boot_args)
|
|
|
fbcaed |
set_kargs_args.append("root=" + self.storage.rootDevice.fstabSpec)
|
|
|
fbcaed |
- self._safeExecWithRedirect("ostree", set_kargs_args)
|
|
|
fbcaed |
-
|
|
|
fbcaed |
- # This command iterates over all files we might have created
|
|
|
fbcaed |
- # and ensures they're labeled. It's like running
|
|
|
fbcaed |
- # chroot(iutil.getTargetPhysicalRoot()) + fixfiles, except
|
|
|
fbcaed |
- # with a better name and semantics.
|
|
|
fbcaed |
- self._safeExecWithRedirect("ostree",
|
|
|
fbcaed |
- ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
|
|
|
fbcaed |
- "instutil", "selinux-ensure-labeled", iutil.getTargetPhysicalRoot(), ""])
|
|
|
fbcaed |
+ self._safeExecWithRedirect("ostree", set_kargs_args, root=iutil.getSysroot())
|
|
|
fbcaed |
--
|
|
|
fbcaed |
1.8.3.1
|
|
|
fbcaed |
|