imgcreate/creator.py | 10 ++++++----
imgcreate/live.py | 11 +++++++----
imgcreate/yuminst.py | 8 ++++++--
tools/livecd-creator | 5 +++++
4 files changed, 24 insertions(+), 10 deletions(-)
New commits:
commit 29303d0b2547c2da87a437c517267417d84581de
Author: Bill Nottingham <notting(a)redhat.com>
Date: Mon Apr 23 18:31:22 2012 -0400
allow for use of yum plugins during livecd creation
https://bugzilla.redhat.com/show_bug.cgi?id=813429
This adds an option ("-p", or "--plugins") to livecd-creator to
allow for
the use of yum plugins during image creation. The initial usage case is
for localized live images that want to use yum-langpacks when creating their
live image so that they include the proper language packs for their locale.
Aside from the noise of propagating the commandline options down to the yum
instance, there is a bugfix where we re-call repository setup after we've
actually added the repositories; this is required so that plugins operate
properly.
Bill
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index 35fe777..d8249cb 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -51,7 +51,7 @@ class ImageCreator(object):
"""
- def __init__(self, ks, name, releasever=None, tmpdir="/tmp"):
+ def __init__(self, ks, name, releasever=None, tmpdir="/tmp",
useplugins=False):
"""Initialize an ImageCreator instance.
ks -- a pykickstart.KickstartParser instance; this instance will be
@@ -72,6 +72,7 @@ class ImageCreator(object):
"""A name for the image."""
self.releasever = releasever
+ self.useplugins = useplugins
self.tmpdir = tmpdir
"""The directory in which all temporary files will be
created."""
@@ -617,7 +618,7 @@ class ImageCreator(object):
"""
yum_conf = self._mktemp(prefix = "yum.conf-")
- ayum = LiveCDYum(releasever=self.releasever)
+ ayum = LiveCDYum(releasever=self.releasever, useplugins=self.useplugins)
ayum.setup(yum_conf, self._instroot)
for repo in kickstart.get_repos(self.ks, repo_urls):
@@ -632,6 +633,7 @@ class ImageCreator(object):
yr.proxy = proxy
if cost is not None:
yr.cost = cost
+ ayum.setup(yum_conf, self._instroot)
if kickstart.exclude_docs(self.ks):
rpm.addMacro("_excludedocs", "1")
@@ -778,7 +780,7 @@ class LoopImageCreator(ImageCreator):
"""
- def __init__(self, ks, name, fslabel=None, releasever=None,
tmpdir="/tmp"):
+ def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
useplugins=False):
"""Initialize a LoopImageCreator instance.
This method takes the same arguments as ImageCreator.__init__() with
@@ -787,7 +789,7 @@ class LoopImageCreator(ImageCreator):
fslabel -- A string used as a label for any filesystems created.
"""
- ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir)
+ ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir,
useplugins=useplugins)
self.__fslabel = None
self.fslabel = fslabel
diff --git a/imgcreate/live.py b/imgcreate/live.py
index d80f518..a73d7f0 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -40,7 +40,7 @@ class LiveImageCreatorBase(LoopImageCreator):
"""
def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp",
- title="Linux", product="Linux"):
+ title="Linux", product="Linux", useplugins=False):
"""Initialise a LiveImageCreator instance.
This method takes the same arguments as LoopImageCreator.__init__().
@@ -49,7 +49,8 @@ class LiveImageCreatorBase(LoopImageCreator):
LoopImageCreator.__init__(self, ks, name,
fslabel=fslabel,
releasever=releasever,
- tmpdir=tmpdir)
+ tmpdir=tmpdir,
+ useplugins=useplugins)
self.compress_type = "xz"
"""mksquashfs compressor to use."""
diff --git a/imgcreate/yuminst.py b/imgcreate/yuminst.py
index d835d9f..5605eea 100644
--- a/imgcreate/yuminst.py
+++ b/imgcreate/yuminst.py
@@ -45,12 +45,13 @@ class TextProgress(object):
self.emit(logging.INFO, "...OK\n")
class LiveCDYum(yum.YumBase):
- def __init__(self, releasever=None):
+ def __init__(self, releasever=None, useplugins=False):
"""
releasever = optional value to use in replacing $releasever in repos
"""
yum.YumBase.__init__(self)
self.releasever = releasever
+ self.useplugins = useplugins
def doFileLogSetup(self, uid, logfile):
# don't do the file log for the livecd as it can lead to open fds
@@ -71,7 +72,10 @@ class LiveCDYum(yum.YumBase):
conf = "[main]\n"
conf += "installroot=%s\n" % installroot
conf += "cachedir=/var/cache/yum\n"
- conf += "plugins=0\n"
+ if self.useplugins:
+ conf += "plugins=1\n"
+ else:
+ conf += "plugins=0\n"
conf += "reposdir=\n"
conf += "failovermethod=priority\n"
conf += "keepcache=1\n"
diff --git a/tools/livecd-creator b/tools/livecd-creator
index 6b2c799..8bb81aa 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -49,6 +49,9 @@ def parse_options(args):
# Provided for img-create compatibility
imgopt.add_option("-n", "--name", type="string",
dest="fslabel",
help=optparse.SUPPRESS_HELP)
+ imgopt.add_option("-p", "--plugins",
action="store_true", dest="plugins",
+ help="Use yum plugins during image creation",
+ default=False)
imgopt.add_option("", "--image-type", type="string",
dest="image_type",
help=optparse.SUPPRESS_HELP)
imgopt.add_option("", "--compression-type",
type="string", dest="compress_type",
@@ -171,11 +174,13 @@ def main():
fslabel=fslabel,
releasever=options.releasever,
tmpdir=os.path.abspath(options.tmpdir),
+ useplugins=options.plugins,
title=title, product=product)
elif options.image_type == 'image':
creator = imgcreate.LoopImageCreator(ks, name,
fslabel=fslabel,
releasever=options.releasever,
+ useplugins=options.plugins,
tmpdir=os.path.abspath(options.tmpdir))
else:
# Cannot happen, we validate this when parsing options.
commit ace3d83189fe1b06640c5451316084f50cb0bd3c
Author: Matthew Garrett <mjg(a)redhat.com>
Date: Tue Apr 24 10:41:48 2012 -0400
Capitalise EFI names
The spec says these are mixed case, but the implementation has them as
upper case. This is fine on vfat, but breaks on iso9660. Make them upper
case.
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 0fc20e9..d80f518 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -771,7 +771,7 @@ hiddenmenu
os.link(isodir + "/EFI/BOOT/grub.conf", isodir +
"/EFI/BOOT/BOOT.conf")
# for most things, we want them named boot$efiarch
- efiarch = {"i386": "ia32", "x86_64":
"x64"}
+ efiarch = {"i386": "IA32", "x86_64":
"X64"}
efiname = efiarch[rpmUtils.arch.getBaseArch()]
os.rename(isodir + "/EFI/BOOT/grub.efi", isodir +
"/EFI/BOOT/BOOT%s.efi" %(efiname,))
os.link(isodir + "/EFI/BOOT/grub.conf", isodir +
"/EFI/BOOT/BOOT%s.conf" %(efiname,))
commit 06322244dc56912366190cb53d9d0957959c6fd8
Author: Matthew Garrett <mjg(a)redhat.com>
Date: Tue Apr 24 09:47:31 2012 -0400
Add tighter Mac boot image integration
Make sure that the Mac boot image ends up with an icon and has the product
info set correctly.
diff --git a/imgcreate/live.py b/imgcreate/live.py
index c5c9db8..0fc20e9 100755
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -234,7 +234,9 @@ class LiveImageCreatorBase(LoopImageCreator):
subprocess.call(["mkefiboot", isodir + "/EFI/BOOT",
isodir + "/isolinux/efiboot.img"])
subprocess.call(["mkefiboot", "-a", isodir +
"/EFI/BOOT",
- isodir + "/isolinux/macboot.img"])
+ isodir + "/isolinux/macboot.img", "-l",
self.product,
+ "-i",
"/usr/share/pixmaps/bootloader/fedora.icns",
+ "-p", self.product])
def _create_bootconfig(self):
"""Configure the image so that it's
bootable."""