Set up default systemd target and copy driver disk files. Also stop
the backend logger.
---
pyanaconda/packaging/__init__.py | 82 +++++++++++++++++++++++++++++++++-----
1 files changed, 72 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index e6026ca..07704da 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -458,22 +458,84 @@ class Payload(object):
""" Install the payload. """
raise NotImplementedError()
+ def _copyDriverDiskFiles(self):
+ import glob
+ import shutil
+
+ new_firmware = False
+
+ # Multiple driver disks may be loaded, so we need to glob for all
+ # the firmware files in the common DD firmware directory
+ for f in glob.glob(DD_FIRMWARE+"/*"):
+ try:
+ shutil.copyfile(f, "%s/lib/firmware/" % ROOT_PATH)
+ except IOError as e:
+ log.error("Could not copy firmware file %s: %s" % (f, e.strerror))
+ else:
+ new_firmware = True
+
+ #copy RPMS
+ for d in glob.glob(DD_RPMS):
+ shutil.copytree(d, ROOT_PATH + "/root/" + os.path.basename(d))
+
+ #copy modules and firmware into root's home directory
+ if os.path.exists(DD_ALL):
+ try:
+ shutil.copytree(DD_ALL, ROOT_PATH + "/root/DD")
+ except IOError as e:
+ pass
+
+ if new_firmware:
+ for kernel in self.kernelVersionList:
+ log.info("recreating initrd for %s" % kernel)
+ iutil.execWithRedirect("new-kernel-pkg",
+ ["--mkinitrd", "--dracut",
+ "--depmod", "--install", kernel],
+ stdout="/dev/null",
+ stderr="/dev/null",
+ root=ROOT_PATH)
+
+ def _setDefaultBootTarget(self):
+ """ Set the default systemd target for the system. """
+ if not os.path.exists(ROOT_PATH + "/etc/systemd/system"):
+ log.error("systemd is not installed -- can't set default target")
+ return
+
+ try:
+ import rpm
+ except ImportError:
+ log.info("failed to import rpm -- defaulting to multi-user.target")
+ default_target = "multi-user.target"
+ else:
+ ts = rpm.TransactionSet(ROOT_PATH)
+
+ # XXX one day this might need to account for anaconda's display mode
+ if ts.dbMatch("provides", 'service(graphical-login)').count() and
+ ts.dbMatch('provides', 'xorg-x11-server-Xorg').count() and
+ not flags.usevnc:
+ default_target = "graphical.target"
+ else:
+ default_target = "multi-user.target"
+
+ symlink_path = ROOT_PATH + '/etc/systemd/system/default.target'
+ if os.path.islink(symlink_path):
+ os.unlink(symlink_path)
+ os.symlink('/usr/lib/systemd/system/' + default_target, symlink_path)
+
def postInstall(self):
""" Perform post-installation tasks. """
- pass
- # set default runlevel/target (?)
+ # set default systemd target
+ self._setDefaultBootTarget()
+
# write out static config (storage, modprobe, keyboard, ??)
# kickstart should handle this before we get here
- # copy firmware
- # recreate initrd
- # postInstall or bootloader.install
- # copy dd rpms (yum/rpm only?)
- # kickstart
- # copy dd modules and firmware (yum/rpm only?)
- # kickstart
- # write escrow packets
+
+ self._copyDriverDiskFiles()
+
# stop logger
+ instlog.stop()
+
class ImagePayload(Payload):
""" An ImagePayload installs an OS image to the target system. """
--
1.7.7.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-02-2012, 07:52 PM
Chris Lumens
Implement some of the various post-install tasks.
> diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
> index e6026ca..07704da 100644
> --- a/pyanaconda/packaging/__init__.py
> +++ b/pyanaconda/packaging/__init__.py
> @@ -458,22 +458,84 @@ class Payload(object):
> """ Install the payload. """
> raise NotImplementedError()
>
> + def _copyDriverDiskFiles(self):
> + import glob
> + import shutil
> +
> + new_firmware = False
> +
> + # Multiple driver disks may be loaded, so we need to glob for all
> + # the firmware files in the common DD firmware directory
> + for f in glob.glob(DD_FIRMWARE+"/*"):
> + try:
> + shutil.copyfile(f, "%s/lib/firmware/" % ROOT_PATH)
> + except IOError as e:
> + log.error("Could not copy firmware file %s: %s" % (f, e.strerror))
> + else:
> + new_firmware = True
> +
> + #copy RPMS
> + for d in glob.glob(DD_RPMS):
> + shutil.copytree(d, ROOT_PATH + "/root/" + os.path.basename(d))
> +
> + #copy modules and firmware into root's home directory
> + if os.path.exists(DD_ALL):
> + try:
> + shutil.copytree(DD_ALL, ROOT_PATH + "/root/DD")
> + except IOError as e:
> + pass
What IO errors do we see occurring both here and above? And, if we
expect that any will actually occur, does just passing or logging and
continuing (basically silently) really make sense, or is this something
the user actually needs to know about?
- Chris
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
05-02-2012, 08:46 PM
David Lehman
Implement some of the various post-install tasks.
On Wed, 2012-05-02 at 15:52 -0400, Chris Lumens wrote:
> > diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
> > index e6026ca..07704da 100644
> > --- a/pyanaconda/packaging/__init__.py
> > +++ b/pyanaconda/packaging/__init__.py
> > @@ -458,22 +458,84 @@ class Payload(object):
> > """ Install the payload. """
> > raise NotImplementedError()
> >
> > + def _copyDriverDiskFiles(self):
> > + import glob
> > + import shutil
> > +
> > + new_firmware = False
> > +
> > + # Multiple driver disks may be loaded, so we need to glob for all
> > + # the firmware files in the common DD firmware directory
> > + for f in glob.glob(DD_FIRMWARE+"/*"):
> > + try:
> > + shutil.copyfile(f, "%s/lib/firmware/" % ROOT_PATH)
> > + except IOError as e:
> > + log.error("Could not copy firmware file %s: %s" % (f, e.strerror))
> > + else:
> > + new_firmware = True
> > +
> > + #copy RPMS
> > + for d in glob.glob(DD_RPMS):
> > + shutil.copytree(d, ROOT_PATH + "/root/" + os.path.basename(d))
> > +
> > + #copy modules and firmware into root's home directory
> > + if os.path.exists(DD_ALL):
> > + try:
> > + shutil.copytree(DD_ALL, ROOT_PATH + "/root/DD")
> > + except IOError as e:
> > + pass
>
> What IO errors do we see occurring both here and above? And, if we
> expect that any will actually occur, does just passing or logging and
> continuing (basically silently) really make sense, or is this something
> the user actually needs to know about?
Good question. I copied this code verbatim from current backend.py. At
the very least we should log an error. IOError is just what
shutil.copytree raises any time is fails to copy something for any
reason IIRC.
>
> - Chris
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list