[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Use rpm to determine how to set bootloader args and default runlevel (#527520).





On Tue, 20 Oct 2009, Chris Lumens wrote:

We were previously using tests that have diverged from what's going on in
yuminstall.py, so this brings the two backend tests into using the same
concept.  Note that these checks can't be moved into the superclass, because
different backends need to use different mechanisms to find out the same
information.
---
livecd.py |   13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/livecd.py b/livecd.py
index 685e172..d1a4c64 100644
--- a/livecd.py
+++ b/livecd.py
@@ -348,6 +348,8 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
            rc = proc.poll()

    def doPostInstall(self, anaconda):
+        import rpm
+
        self._doFilesystemMangling(anaconda)

        # setup /etc/rpm/ for the post-install environment
@@ -355,12 +357,17 @@ class LiveCDCopyBackend(backend.AnacondaBackend):

        storage.writeEscrowPackets(anaconda)

-        # maybe heavy handed, but it'll do
-        if os.path.exists(anaconda.rootPath + "/usr/bin/rhgb") or os.path.exists(anaconda.rootPath + "/usr/bin/plymouth"):
+        iutil.resetRpmDb(anaconda.rootPath)
+        ts = rpm.TransactionSet(anaconda.rootPath)
+
+        if ts.dbMatch('provides', 'plymouth').count() or ts.dbMatch('provides', 'rhgb').count():
            anaconda.id.bootloader.args.append("rhgb quiet")
-        if os.path.exists(anaconda.rootPath + "/usr/sbin/gdm") or os.path.exists(anaconda.rootPath + "/usr/bin/kdm"):
+
+        if ts.dbMatch('provides', 'service(graphical-login)').count():
            anaconda.id.desktop.setDefaultRunLevel(5)

+        ts.closeDB()
+

maybe instead of using rpm - you could still do this using yum?

import yum.rpmsack
r = yum.rpmsack.RPMDBPackageSack()
r.searchProvides(....)

or something to that effect?

if I'm missing something about what the goal is here, let me know.

-sv



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]