From 78e3d0f115b1e460e2444512498ad09fc1aa37ad Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Mon, 26 Nov 2012 17:26:45 -0600 Subject: [PATCH] add installupgradeinitrd function and use it to install the upgrade initrds --- share/arm.tmpl | 6 ++---- share/ppc.tmpl | 3 +-- share/s390.tmpl | 3 +-- share/x86.tmpl | 6 ++---- src/pylorax/ltmpl.py | 9 +++++++++ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/share/arm.tmpl b/share/arm.tmpl index 08d9254d..de1c8c84 100644 --- a/share/arm.tmpl +++ b/share/arm.tmpl @@ -33,8 +33,7 @@ mkdir ${KERNELDIR} installinitrd images-${kernel.flavor}-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img ## install upgrade image - installinitrd ${kernel.upgrade.img} ${KERNELDIR}/upgrade-${kernel.flavor}.img - treeinfo images-${kernel.flavor}-${basearch} upgrade ${KERNELDIR}/upgrade-${kernel.flavor}.img + installupgradeinitrd images-${kernel.flavor}-${basearch} ${kernel.upgrade.img} ${KERNELDIR}/upgrade-${kernel.flavor}.img ## create U-Boot wrapped images @@ -60,8 +59,7 @@ mkdir ${KERNELDIR} installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ## install upgrade image - installinitrd ${kernel.upgrade.img} ${KERNELDIR}/upgrade.img - treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img + installupgradeinitrd images-${basearch} ${kernel.upgrade.img} ${KERNELDIR}/upgrade.img ## create U-Boot wrapped images diff --git a/share/ppc.tmpl b/share/ppc.tmpl index 3eb4a898..4eb0b0c3 100644 --- a/share/ppc.tmpl +++ b/share/ppc.tmpl @@ -67,8 +67,7 @@ install ${configdir}/magic ${BOOTDIR} installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ## upgrade image - installinitrd ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img - treeinfo images-${kernel.arch} upgrade ${KERNELDIR}/upgrade.img + installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img ## install arch-specific bootloader config install ${configdir}/yaboot.conf.in ${KERNELDIR}/yaboot.conf diff --git a/share/s390.tmpl b/share/s390.tmpl index dcd78d27..9380c759 100644 --- a/share/s390.tmpl +++ b/share/s390.tmpl @@ -25,8 +25,7 @@ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/kernel.img installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img ## upgrader image -installinitrd ${kernel.upgrade.img} ${KERNELDIR}/upgrade.img -treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img +installupgradeinitrd images-${basearch} ${kernel.upgrade.img} ${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 de2ab890..6e1f3055 100644 --- a/share/x86.tmpl +++ b/share/x86.tmpl @@ -34,14 +34,12 @@ mkdir ${KERNELDIR} ## i386 PAE installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor} installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img - installinitrd ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img - treeinfo images-xen upgrade ${KERNELDIR}/upgrade-${kernel.flavor}.img + installupgradeinitrd images-xen ${kernel.upgrade.path} ${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 - installinitrd ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img - treeinfo images-${basearch} upgrade ${KERNELDIR}/upgrade.img + installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img %endif %endfor diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 3dda5579..040f1aa6 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -305,6 +305,15 @@ class LoraxTemplateRunner(object): self.chmod(dest, '644') self.treeinfo(section, "initrd", dest) + def installupgradeinitrd(self, section, src, dest): + ''' + installupgradeinitrd SECTION SRC DEST + Same as installkernel, but for "upgrade". + ''' + self.install(src, dest) + self.chmod(dest, '644') + self.treeinfo(section, "upgrade", dest) + def hardlink(self, src, dest): ''' hardlink SRC DEST