aadd patches for fedup support

This commit is contained in:
Dennis Gilmore 2012-11-19 18:52:59 -06:00
parent dee1bbab31
commit 6493e18beb
7 changed files with 434 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 88caf0bdb2fce8c5c2b0545be0bc13dd8bf5534e Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Tue, 13 Nov 2012 01:33:14 -0500
Subject: [PATCH 1/6] treebuilder: add 'prefix' to rebuild_initrds()
If 'prefix' is passed to rebuild_initrds(), it will build a *new*
initramfs with a name like $PREFIX-$KERNELVER.img, rather than
overwriting the existing initramfs.
---
src/pylorax/treebuilder.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index 3ff0e6f..74a59ae 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -186,10 +186,13 @@ class TreeBuilder(object):
def kernels(self):
return findkernels(root=self.vars.inroot)
- def rebuild_initrds(self, add_args=[], backup=""):
+ def rebuild_initrds(self, add_args=[], backup="", prefix=""):
'''Rebuild all the initrds in the tree. If backup is specified, each
initrd will be renamed with backup as a suffix before rebuilding.
- If backup is empty, the existing initrd files will be overwritten.'''
+ If backup is empty, the existing initrd files will be overwritten.
+ If suffix is specified, the existing initrd is untouched and a new
+ image is built with the filename "${prefix}-${kernel.version}.img"
+ '''
dracut = ["dracut", "--nomdadmconf", "--nolvmconf"] + add_args
if not backup:
dracut.append("--force")
@@ -197,11 +200,16 @@ class TreeBuilder(object):
# Hush some dracut warnings. TODO: bind-mount proc in place?
open(joinpaths(self.vars.inroot,"/proc/modules"),"w")
for kernel in self.kernels:
- logger.info("rebuilding %s", kernel.initrd.path)
+ if prefix:
+ idir = os.path.dirname(kernel.initrd.path)
+ outfile = joinpaths(idir, prefix+'-'+kernel.version+'.img')
+ else:
+ outfile = kernel.initrd.path
+ logger.info("rebuilding %s", outfile)
if backup:
- initrd = joinpaths(self.vars.inroot, kernel.initrd.path)
+ initrd = joinpaths(self.vars.inroot, outfile)
os.rename(initrd, initrd + backup)
- cmd = dracut + [kernel.initrd.path, kernel.version]
+ cmd = dracut + [outfile, kernel.version]
runcmd(cmd, root=self.vars.inroot)
os.unlink(joinpaths(self.vars.inroot,"/proc/modules"))
--
1.8.0

View File

@ -0,0 +1,60 @@
From d11a97fec8efc57f1a6cb2f1bbb270dc67bf873a Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Tue, 13 Nov 2012 01:33:15 -0500
Subject: [PATCH 2/6] treebuilder: improve findkernels() initrd search
This makes findkernels() look for any image named something like:
$PREFIX-$KERNELVER.img
and adds a corresponding entry to its returned data like:
kernel.$PREFIX.path = [path]
As a special backwards-compatibility case we use 'initrd' for the
attribute name if $PREFIX is 'initramfs'.
This gives us any extra initramfs images that may have been built using
the 'prefix' argument to rebuild_initrds().
---
src/pylorax/treebuilder.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
index 74a59ae..17f2ae6 100644
--- a/src/pylorax/treebuilder.py
+++ b/src/pylorax/treebuilder.py
@@ -266,20 +266,23 @@ def findkernels(root="/", kdir="boot"):
kre = re.compile(r"vmlinuz-(?P<version>.+?\.(?P<arch>[a-z0-9_]+)"
r"(\.(?P<flavor>{0}))?)$".format("|".join(flavors)))
kernels = []
- for f in os.listdir(joinpaths(root, kdir)):
+ bootfiles = os.listdir(joinpaths(root, kdir))
+ for f in bootfiles:
match = kre.match(f)
if match:
kernel = DataHolder(path=joinpaths(kdir, f))
kernel.update(match.groupdict()) # sets version, arch, flavor
kernels.append(kernel)
- # look for associated initrd/initramfs
+ # look for associated initrd/initramfs/etc.
for kernel in kernels:
- # NOTE: if both exist, the last one found will win
- for imgname in ("initrd", "initramfs"):
- i = kernel.path.replace("vmlinuz", imgname, 1) + ".img"
- if os.path.exists(joinpaths(root, i)):
- kernel.initrd = DataHolder(path=i)
+ for f in bootfiles:
+ if f.endswith('-'+kernel.version+'.img'):
+ imgtype, rest = f.split('-',1)
+ # special backwards-compat case
+ if imgtype == 'initramfs':
+ imgtype = 'initrd'
+ kernel[imgtype] = DataHolder(path=joinpaths(kdir, f))
return kernels
--
1.8.0

View File

@ -0,0 +1,53 @@
From f78b7e0b27da49e3465425e24eacf4e92594cba4 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Tue, 13 Nov 2012 01:33:16 -0500
Subject: [PATCH 3/6] build fedup upgrade.img
Use rebuild_initrds() with prefix='upgrade' to build upgrade.img with
the fedup "system-upgrade" module(s) inside.
---
share/runtime-install.tmpl | 3 +++
src/pylorax/__init__.py | 13 ++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index 72fc34a..68a7545 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -48,6 +48,9 @@ installpkg plymouth
## extra dracut modules
installpkg dracut-network anaconda-dracut
+## fedup-dracut handles upgrades
+installpkg fedup-dracut fedup-dracut-plymouth *-fedup-dracut
+
## rpcbind or portmap needed by dracut nfs module
installpkg rpcbind
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 6120dc3..20a84c3 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -278,9 +278,16 @@ class Lorax(BaseLoraxClass):
domacboot=domacboot, templatedir=templatedir)
logger.info("rebuilding initramfs images")
- dracut_args=["--xz", "--add", "anaconda pollcdrom",
- "--install", "/.buildstamp"]
- treebuilder.rebuild_initrds(add_args=dracut_args)
+ dracut_args = ["--xz", "--install", "/.buildstamp"]
+
+ anaconda_args = dracut_args + ["--add", "anaconda pollcdrom"]
+ treebuilder.rebuild_initrds(add_args=anaconda_args)
+
+ # Build upgrade.img. It'd be nice if these could coexist in the same
+ # image, but that would increase the size of the anaconda initramfs,
+ # which worries some people (esp. PPC tftpboot). So they're separate.
+ upgrade_args = dracut_args + ["--add", "system-upgrade"]
+ treebuilder.rebuild_initrds(add_args=upgrade_args, prefix="upgrade")
logger.info("populating output tree and building boot images")
treebuilder.build()
--
1.8.0

View File

@ -0,0 +1,107 @@
From 5df53dcbf2c1530beea9911594482b968639da2a Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Tue, 13 Nov 2012 01:33:17 -0500
Subject: [PATCH 4/6] make templates install upgrade.img
---
share/arm.tmpl | 12 ++++++++++--
share/ppc.tmpl | 4 ++++
share/s390.tmpl | 4 ++++
share/x86.tmpl | 8 ++++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/share/arm.tmpl b/share/arm.tmpl
index 699b8b4..6afadca 100644
--- a/share/arm.tmpl
+++ b/share/arm.tmpl
@@ -32,7 +32,11 @@ mkdir ${KERNELDIR}
installkernel images-${kernel.flavor}-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
- # create U-Boot wrapped images
+ ## install upgrader image
+ install ${kernel.upgrader.img} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+ treeinfo images-${kernel.flavor}-${basearch} upgrade ${KERNELDIR}/upgrade-${kernel.flavor}.img
+
+ ## create U-Boot wrapped images
runcmd mkimage \
-A arm -O linux -T ramdisk -C none \
@@ -55,7 +59,11 @@ mkdir ${KERNELDIR}
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
- # create U-Boot wrapped images
+ ## install upgrader image
+ install ${kernel.upgrader.img} ${KERNELDIR}/upgrade.img
+ treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img
+
+ ## create U-Boot wrapped images
runcmd mkimage \
-A arm -O linux -T ramdisk -C none \
diff --git a/share/ppc.tmpl b/share/ppc.tmpl
index 65215d6..984f294 100644
--- a/share/ppc.tmpl
+++ b/share/ppc.tmpl
@@ -66,6 +66,10 @@ install ${configdir}/magic ${BOOTDIR}
installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
+ ## upgrader image
+ install ${kernel.upgrader.path} ${KERNELDIR}/upgrade.img
+ treeinfo images-${kernel.arch} upgrade ${KERNELDIR}/upgrade.img
+
## install arch-specific bootloader config
install ${configdir}/yaboot.conf.in ${KERNELDIR}/yaboot.conf
replace @BITS@ ${bits} ${KERNELDIR}/yaboot.conf
diff --git a/share/s390.tmpl b/share/s390.tmpl
index f02963d..3af81d4 100644
--- a/share/s390.tmpl
+++ b/share/s390.tmpl
@@ -24,6 +24,10 @@ replace @INITRD_LOAD_ADDRESS@ ${INITRD_ADDRESS} generic.ins
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
+## upgrader image
+install ${kernel.upgrade.img} ${KERNELDIR}/upgrade.img
+treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img
+
## s390 needs some extra boot config
createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
diff --git a/share/x86.tmpl b/share/x86.tmpl
index ac41d89..92e01fc 100644
--- a/share/x86.tmpl
+++ b/share/x86.tmpl
@@ -31,19 +31,27 @@ replace @ROOT@ 'inst.stage2=hd:LABEL=${isolabel|udev}' ${BOOTDIR}/isolinux.cfg
mkdir ${KERNELDIR}
%for kernel in kernels:
%if kernel.flavor:
+ ## i386 PAE
installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
+ install ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
+ treeinfo images-xen upgrade ${KERNELDIR}/upgrade-${kernel.flavor}.img
%else:
+ ## normal i386, x86_64
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
+ install ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
+ treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img
%endif
%endfor
hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR}
hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
+hardlink ${KERNELDIR}/upgrade.img ${BOOTDIR}
%if basearch == 'x86_64':
treeinfo images-xen kernel ${KERNELDIR}/vmlinuz
treeinfo images-xen initrd ${KERNELDIR}/initrd.img
+ treeinfo images-xen upgrade ${KERNELDIR}/upgrade.img
%endif
## WHeeeeeeee, EFI.
--
1.8.0

View File

@ -0,0 +1,40 @@
From aa1775da338a93494ef952dfb355157e192a7724 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Tue, 13 Nov 2012 01:33:18 -0500
Subject: [PATCH 5/6] Add the 'fedup' plymouth theme if available
---
src/pylorax/__init__.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 20a84c3..95f912f 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -47,7 +47,7 @@ from treebuilder import RuntimeBuilder, TreeBuilder
from buildstamp import BuildStamp
from treeinfo import TreeInfo
from discinfo import DiscInfo
-from executils import runcmd
+from executils import runcmd, runcmd_output
class ArchData(DataHolder):
lib64_arches = ("x86_64", "ppc64", "sparc64", "s390x", "ia64")
@@ -286,6 +286,14 @@ class Lorax(BaseLoraxClass):
# Build upgrade.img. It'd be nice if these could coexist in the same
# image, but that would increase the size of the anaconda initramfs,
# which worries some people (esp. PPC tftpboot). So they're separate.
+ try:
+ # If possible, use the 'fedup' plymouth theme
+ themes = runcmd_output(['plymouth-set-default-theme', '--list'],
+ root=installroot)
+ if 'fedup' in themes.splitlines():
+ os.environ['PLYMOUTH_THEME_NAME'] = 'fedup'
+ except RuntimeError:
+ pass
upgrade_args = dracut_args + ["--add", "system-upgrade"]
treebuilder.rebuild_initrds(add_args=upgrade_args, prefix="upgrade")
--
1.8.0

View File

@ -0,0 +1,100 @@
From 0fb5f115d0e8a5160c9eefabbd5b242de987f9ee Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
Date: Thu, 15 Nov 2012 17:47:18 -0600
Subject: [PATCH 6/6] add options in the boot media to do upgrades
---
share/config_files/ppc/yaboot.conf.in | 5 +++++
share/config_files/x86/grub.conf | 6 +++++-
share/config_files/x86/grub2-efi.cfg | 6 +++++-
share/config_files/x86/isolinux.cfg | 6 +++++-
share/efi.tmpl | 1 +
5 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/share/config_files/ppc/yaboot.conf.in b/share/config_files/ppc/yaboot.conf.in
index 0a6bafc..c2d851d 100644
--- a/share/config_files/ppc/yaboot.conf.in
+++ b/share/config_files/ppc/yaboot.conf.in
@@ -7,3 +7,8 @@ image=/ppc/ppc@BITS@/vmlinuz
initrd=/ppc/ppc@BITS@/initrd.img
read-only
append="@ROOT@"
+image=/ppc/ppc@BITS@/vmlinuz
+ label=upgrade
+ initrd=/ppc/ppc@BITS@/upgrade.img
+ read-only
+ append="@ROOT@"
diff --git a/share/config_files/x86/grub.conf b/share/config_files/x86/grub.conf
index d1ce3be..45f0b54 100644
--- a/share/config_files/x86/grub.conf
+++ b/share/config_files/x86/grub.conf
@@ -3,10 +3,14 @@ default=0
splashimage=@SPLASHPATH@
timeout 5
hiddenmenu
-title @PRODUCT@ @VERSION@
+title @PRODUCT@ @VERSION@ Install
findiso
kernel @KERNELPATH@ @ROOT@
initrd @INITRDPATH@
+title @PRODUCT@ @VERSION@ Upgrade
+ findiso
+ kernel @KERNELPATH@ @ROOT@
+ initrd @UPGRADEINITRDPATH@
title Test this media & start @PRODUCT@
findiso
kernel @KERNELPATH@ @ROOT@ quiet rd.live.check
diff --git a/share/config_files/x86/grub2-efi.cfg b/share/config_files/x86/grub2-efi.cfg
index f21d085..8c80bbf 100644
--- a/share/config_files/x86/grub2-efi.cfg
+++ b/share/config_files/x86/grub2-efi.cfg
@@ -20,10 +20,14 @@ set timeout=5
search --no-floppy --set=root -l '@ISOLABEL@'
### BEGIN /etc/grub.d/10_linux ###
-menuentry '@PRODUCT@ @VERSION@' --class fedora --class gnu-linux --class gnu --class os {
+menuentry '@PRODUCT@ @VERSION@ Install' --class fedora --class gnu-linux --class gnu --class os {
linuxefi @KERNELPATH@ @ROOT@
initrdefi @INITRDPATH@
}
+menuentry '@PRODUCT@ @VERSION@ Upgrade' --class fedora --class gnu-linux --class gnu --class os {
+ linuxefi @KERNELPATH@ @ROOT@
+ initrdefi @UPGRADEINITRDPATH@
+}
menuentry 'Test this media & start @PRODUCT@' --class fedora --class gnu-linux --class gnu --class os {
linuxefi @KERNELPATH@ @ROOT@ quiet rd.live.check
initrdefi @INITRDPATH@
diff --git a/share/config_files/x86/isolinux.cfg b/share/config_files/x86/isolinux.cfg
index f530784..1098d2d 100644
--- a/share/config_files/x86/isolinux.cfg
+++ b/share/config_files/x86/isolinux.cfg
@@ -57,9 +57,13 @@ menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label linux
- menu label ^Install/upgrade @PRODUCT@
+ menu label ^Install @PRODUCT@
kernel vmlinuz
append initrd=initrd.img @ROOT@ quiet
+label upgrade
+ menu label ^Upgrade @PRODUCT@
+ kernel vmlinuz
+ append initrd=upgrade.img @ROOT@ quiet
label check
menu label Test this ^media & install/upgrade @PRODUCT@
menu default
diff --git a/share/efi.tmpl b/share/efi.tmpl
index d69fdb7..a60d5cd 100644
--- a/share/efi.tmpl
+++ b/share/efi.tmpl
@@ -36,6 +36,7 @@ ${make_efiboot("images/efiboot.img")}
replace @KERNELNAME@ vmlinuz ${eficonf}
replace @KERNELPATH@ /${kdir}/vmlinuz ${eficonf}
replace @INITRDPATH@ /${kdir}/initrd.img ${eficonf}
+ replace @UPGRADEINITRDPATH@ /${kdir}/upgrade.img ${eficonf}
replace @ISOLABEL@ '${isolabel}' ${eficonf}
%if disk:
replace @ROOT@ inst.stage2=hd:LABEL=ANACONDA ${eficonf}
--
1.8.0

View File

@ -2,7 +2,7 @@
Name: lorax
Version: 18.22
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Tool for creating the anaconda install images
Group: Applications/System
@ -34,6 +34,8 @@ Requires: util-linux
Requires: xz
Requires: yum
Requires: pykickstart
Requires: fedup-dracut
Requires: fedup-dracut-plymouth
%ifarch %{ix86} x86_64
Requires: syslinux >= 4.02-5
@ -51,6 +53,13 @@ Requires: kernel-bootwrapper
Requires: openssh
%endif
Patch0: 0001-treebuilder-add-prefix-to-rebuild_initrds.patch
Patch1: 0002-treebuilder-improve-findkernels-initrd-search.patch
Patch2: 0003-build-fedup-upgrade.img.patch
Patch3: 0004-make-templates-install-upgrade.img.patch
Patch4: 0005-Add-the-fedup-plymouth-theme-if-available.patch
Patch5: 0006-add-options-in-the-boot-media-to-do-upgrades.patch
%description
Lorax is a tool for creating the anaconda install images.
@ -60,6 +69,12 @@ Anaconda's image install feature.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
@ -82,6 +97,9 @@ make DESTDIR=$RPM_BUILD_ROOT install
%changelog
* Tue Nov 20 2012 Dennis Gilmore <dennis@ausil.us> 18.22-2
- aadd patches for fedup support
* Tue Nov 06 2012 Brian C. Lane <bcl@redhat.com> 18.22-1
- Install the yum-langpacks plugin (#868869) (jkeating@redhat.com)
- perl is required by some low-level tools on s390x (#868824) (dan@danny.cz)