Compare commits
26 Commits
master
...
f22-branch
Author | SHA1 | Date | |
---|---|---|---|
|
ba531e97a0 | ||
|
372ba1ed16 | ||
|
631daa0178 | ||
|
160be350fb | ||
|
0274b91a14 | ||
|
863039555d | ||
|
620849968f | ||
|
85d3652af5 | ||
|
4a4a62ce1b | ||
|
8e2556474d | ||
|
8619ec59cc | ||
|
240f688fb3 | ||
|
bf620f9662 | ||
|
0f65bc4a31 | ||
|
e76a4ea15c | ||
|
92808bcbe6 | ||
|
c45255b666 | ||
|
229759f411 | ||
|
5155ff65ac | ||
|
ebf107a28e | ||
|
0f79920957 | ||
|
a0e35dbbe0 | ||
|
68656592e2 | ||
|
c0b1063397 | ||
|
a612c1ebd0 | ||
|
281218b258 |
@ -78,9 +78,6 @@ volume id
|
||||
.TP
|
||||
\fB\-\-nomacboot\fR
|
||||
|
||||
.TP
|
||||
\fB\-\-noupgrade\fR
|
||||
|
||||
.TP
|
||||
\fB\-\-logfile=LOGFILE\fR
|
||||
Path to logfile
|
||||
@ -95,4 +92,3 @@ Martin Gracik
|
||||
Will Woods
|
||||
Brian C. Lane
|
||||
.fi
|
||||
|
||||
|
52
lorax.spec
52
lorax.spec
@ -1,14 +1,18 @@
|
||||
%define debug_package %{nil}
|
||||
|
||||
Name: lorax
|
||||
Version: 22.4
|
||||
Version: 22.14
|
||||
Release: 1%{?dist}
|
||||
Summary: Tool for creating the anaconda install images
|
||||
|
||||
Group: Applications/System
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rhinstaller/lorax
|
||||
Source0: https://github.com/rhinstaller/%{name}/archive/%{name}-${version}-%{release}.tar.gz
|
||||
# To generate Source0 do:
|
||||
# git clone https://github.com/rhinstaller/lorax
|
||||
# git checkout -b archive-branch lorax-%%{version}-%%{release}
|
||||
# tito build --tgz
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: python2-devel
|
||||
|
||||
@ -39,8 +43,6 @@ Requires: dracut >= 030
|
||||
|
||||
%if 0%{?fedora}
|
||||
# Fedora specific deps
|
||||
Requires: fedup-dracut
|
||||
Requires: fedup-dracut-plymouth
|
||||
%ifarch x86_64
|
||||
Requires: hfsplus-tools
|
||||
%endif
|
||||
@ -76,7 +78,7 @@ including live isos and disk images. It can use libvirtd for the install, or
|
||||
Anaconda's image install feature.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%build
|
||||
|
||||
@ -102,6 +104,46 @@ make DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} install
|
||||
%{_mandir}/man1/*.1*
|
||||
|
||||
%changelog
|
||||
* Tue Mar 29 2016 Brian C. Lane <bcl@redhat.com> 22.14-1
|
||||
- don't build upgrade.img anymore (wwoods@redhat.com)
|
||||
- templates: On 32 bit systems limit the amount of memory xz uses
|
||||
(bcl@redhat.com)
|
||||
- ltmpl: Add compressor selection and argument passing to installimg
|
||||
(bcl@redhat.com)
|
||||
|
||||
* Fri Oct 30 2015 Brian C. Lane <bcl@redhat.com> 22.13-1
|
||||
- drop fedup-dracut and friends (wwoods@redhat.com)
|
||||
|
||||
* Wed May 27 2015 Brian C. Lane <bcl@redhat.com> 22.12-1
|
||||
- Use imgutils.copytree instead of shutil (#1221878) (bcl@redhat.com)
|
||||
|
||||
* Thu May 07 2015 Brian C. Lane <bcl@redhat.com> 22.11-1
|
||||
- Make sure openssh-clients is installed (#1219398) (bcl@redhat.com)
|
||||
|
||||
* Wed Apr 29 2015 Brian C. Lane <bcl@redhat.com> 22.10-1
|
||||
- Add product.img support for s390 templates (dan@danny.cz)
|
||||
|
||||
* Thu Apr 02 2015 Brian C. Lane <bcl@redhat.com> 22.9-1
|
||||
- Include cryptsetup in the image (#1208214) (bcl@redhat.com)
|
||||
|
||||
* Fri Mar 27 2015 Brian C. Lane <bcl@redhat.com> 22.8-1
|
||||
- livemedia-creator: Clean up resultdir handling (bcl@redhat.com)
|
||||
- Add ability for external templates to graft content into boot.iso
|
||||
(walters@verbum.org)
|
||||
|
||||
* Fri Mar 20 2015 Brian C. Lane <bcl@redhat.com> 22.7-1
|
||||
- Include ld.so.conf (#1204031) (bcl@redhat.com)
|
||||
- Keep logitech hid drivers (#1199770) (bcl@redhat.com)
|
||||
|
||||
* Mon Mar 16 2015 Brian C. Lane <bcl@redhat.com> 22.6-1
|
||||
- Don't erase /usr/lib/os.release.d (sgallagh@redhat.com)
|
||||
- Fix Source0 for use with github (bcl@redhat.com)
|
||||
|
||||
* Thu Feb 12 2015 Brian C. Lane <bcl@redhat.com> 22.5-1
|
||||
- os-release moved to /usr/lib (#1191713) (bcl@redhat.com)
|
||||
- Use /usr/bin/python2 in scripts (bcl@redhat.com)
|
||||
- Add bridge-utils (#1188812) (bcl@redhat.com)
|
||||
|
||||
* Fri Feb 06 2015 Brian C. Lane <bcl@redhat.com> 22.4-1
|
||||
- livemedia-creator: Add --timeout option to cancel install after X minutes
|
||||
(bcl@redhat.com)
|
||||
|
@ -1 +1 @@
|
||||
22.4-1 ./
|
||||
22.14-1 ./
|
||||
|
@ -17,9 +17,6 @@ mkdir ${KERNELDIR}
|
||||
## normal aarch64
|
||||
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
%if doupgrade:
|
||||
installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
#FIXME: this will need adjusted when we have a real bootloader.
|
||||
@ -47,6 +44,13 @@ mkdir ${KERNELDIR}
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
||||
%if exists("boot/efi/EFI/*/gcdaa64.efi"):
|
||||
## make boot.iso
|
||||
runcmd mkisofs -o ${outroot}/images/boot.iso \
|
||||
|
@ -36,22 +36,6 @@ mkdir ${KERNELDIR}
|
||||
platforms = platforms + delimiter + kernel.flavor
|
||||
delimiter = ','
|
||||
%>
|
||||
|
||||
%if doupgrade:
|
||||
## install upgrade image
|
||||
installupgradeinitrd images-${kernel.flavor}-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
|
||||
|
||||
runcmd mkimage \
|
||||
-A arm -O linux -T ramdisk -C none \
|
||||
-a 0 -e 0 \
|
||||
-n "${product.name} ${product.version} ${kernel.flavor} ${kernel.arch}" \
|
||||
-d ${outroot}/${KERNELDIR}/upgrade-${kernel.flavor}.img \
|
||||
${outroot}/${KERNELDIR}/uUpgrade-${kernel.flavor}
|
||||
|
||||
treeinfo images-${kernel.flavor}-${basearch} uupgrade ${KERNELDIR}/uUpgrade-${kernel.flavor}
|
||||
|
||||
%endif
|
||||
|
||||
## create U-Boot wrapped images
|
||||
|
||||
runcmd mkimage \
|
||||
@ -75,21 +59,6 @@ mkdir ${KERNELDIR}
|
||||
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
|
||||
%if doupgrade:
|
||||
## install upgrade image
|
||||
installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
|
||||
runcmd mkimage \
|
||||
-A arm -O linux -T ramdisk -C none \
|
||||
-a 0 -e 0 \
|
||||
-n "${product.name} ${product.version} ${kernel.flavor} ${kernel.arch}" \
|
||||
-d ${outroot}/${KERNELDIR}/upgrade.img \
|
||||
${outroot}/${KERNELDIR}/uUpgrade
|
||||
|
||||
treeinfo images-${basearch} uupgrade ${KERNELDIR}/uUpgrade
|
||||
|
||||
%endif
|
||||
|
||||
## create U-Boot wrapped images
|
||||
|
||||
runcmd mkimage \
|
||||
@ -119,9 +88,15 @@ treeinfo ${basearch} platforms ${platforms}
|
||||
<% images=["product", "updates"] %>
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
installimg --xz -9 --memlimit-compress=3700MiB ${LORAXDIR}/${img}/ images/${img}.img
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
## FIXME: ARM may need some extra boot config
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
||||
## FIXME: ARM may need some extra boot config
|
||||
|
@ -74,7 +74,7 @@ mkdir ${KERNELDIR}
|
||||
<% images=["product", "updates"] %>
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
installimg --xz -9 --memlimit-compress=3700MiB ${LORAXDIR}/${img}/ images/${img}.img
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
|
@ -4,6 +4,7 @@ configdir="tmp/config_files/s390"
|
||||
BOOTDIR="images"
|
||||
KERNELDIR=BOOTDIR
|
||||
INITRD_ADDRESS="0x02000000"
|
||||
LORAXDIR="usr/share/lorax/"
|
||||
# The assumption seems to be that there is only one s390 kernel, ever
|
||||
kernel = kernels[0]
|
||||
%>
|
||||
@ -31,3 +32,12 @@ createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${B
|
||||
treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize
|
||||
treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm
|
||||
treeinfo images-${basearch} generic.ins generic.ins
|
||||
|
||||
# Create optional product.img and updates.img
|
||||
<% imggraft=""; images=["product", "updates"] %>
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
%endif
|
||||
%endfor
|
||||
|
@ -75,10 +75,14 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
|
||||
%endif
|
||||
|
||||
# Create optional product.img and updates.img
|
||||
<% imggraft=""; images=["product", "updates"] %>
|
||||
<% imggraft=""; images=["product", "updates"]; compressargs=None; %>
|
||||
%if basearch == 'i386':
|
||||
# Limit the amount of memory xz uses on i386
|
||||
<% compressargs="--xz -9 --memlimit-compress=3700MiB" %>
|
||||
%endif
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
installimg ${compressargs} ${LORAXDIR}/${img}/ images/${img}.img
|
||||
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
%endif
|
||||
%endfor
|
||||
|
@ -68,11 +68,6 @@ install ${configdir}/mapping ${BOOTDIR}
|
||||
installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
|
||||
%if doupgrade:
|
||||
## upgrade image
|
||||
installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
|
||||
## kernel-wrapper magic that makes the netboot combined ppc{32,64}.img
|
||||
runcmd ${inroot}/${WRAPPER} -p of \
|
||||
-D ${inroot}/${WRAPPER_DATA} \
|
||||
@ -96,6 +91,13 @@ install ${configdir}/mapping ${BOOTDIR}
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
||||
## make boot.iso
|
||||
runcmd mkisofs -o ${outroot}/images/boot.iso -chrp-boot -U \
|
||||
${prepboot} -part -hfs -T -r -l -J \
|
||||
|
@ -54,11 +54,6 @@ install ${configdir}/mapping ${BOOTDIR}
|
||||
installkernel images-${kernel.arch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
installinitrd images-${kernel.arch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
|
||||
%if doupgrade:
|
||||
## upgrade image
|
||||
installupgradeinitrd images-${kernel.arch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
|
||||
treeinfo images-${kernel.arch} zimage
|
||||
%endfor
|
||||
|
||||
@ -72,6 +67,13 @@ mkdir images/
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
||||
## make boot.iso
|
||||
runcmd mkisofs -v -U -J -R -T \
|
||||
-o ${outroot}/images/boot.iso \
|
||||
|
@ -27,7 +27,8 @@ removefrom dracut --allbut /usr/lib/dracut/modules.d/30convertfs/convertfs.sh \
|
||||
## we don't run SELinux (not in enforcing, anyway)
|
||||
removepkg checkpolicy selinux-policy libselinux-utils
|
||||
## anaconda has its own repo files
|
||||
removefrom fedora-release --allbut /etc/os-release /usr/lib/os-release
|
||||
removefrom fedora-release --allbut /etc/os-release /usr/lib/os-release \
|
||||
/usr/lib/os.release.d/*
|
||||
removepkg fedora-release-rawhide
|
||||
## no user accounts = no account management
|
||||
removepkg usermode usermode-gtk passwd shadow-utils
|
||||
@ -81,7 +82,7 @@ sound drivers/media drivers/hwmon drivers/video
|
||||
net/atm net/bluetooth net/sched net/sctp
|
||||
net/rds net/l2tp net/decnet net/netfilter net/ipv4 net/ipv6
|
||||
drivers/watchdog drivers/target drivers/rtc drivers/input/joystick
|
||||
drivers/bluetooth drivers/hid drivers/edac drivers/staging
|
||||
drivers/bluetooth drivers/edac drivers/staging
|
||||
drivers/usb/serial drivers/usb/host drivers/usb/misc
|
||||
fs/ocfs2 fs/ceph fs/nfsd fs/ubifs fs/nilfs2
|
||||
arch/x86/kvm
|
||||
@ -101,6 +102,12 @@ runcmd chroot ${root} find /lib/modules \
|
||||
\! -name virtio-rng.ko\* \
|
||||
\! -name ipmi\* \
|
||||
-delete
|
||||
# Remove all of drivers/hid except for logitech modules.
|
||||
runcmd chroot ${root} find /lib/modules \
|
||||
-regex ".*/kernel/drivers/hid/.*" \
|
||||
\! -name hid-logitech-hidpp.ko\* \
|
||||
\! -name hid-logitech-dj.ko\* \
|
||||
-delete
|
||||
## NOTE: depmod gets re-run after cleanup finishes
|
||||
|
||||
## remove unused themes, theme engines, icons, etc.
|
||||
@ -184,7 +191,7 @@ removefrom gdisk /usr/share/*
|
||||
removefrom gdk-pixbuf2 /usr/share/locale*
|
||||
removefrom gfs2-utils /usr/sbin/*
|
||||
removefrom glib2 /etc/* /usr/bin/* /usr/share/locale/*
|
||||
removefrom glibc /etc/gai.conf /etc/ld.so.conf /etc/localtime /etc/rpc
|
||||
removefrom glibc /etc/gai.conf /etc/localtime /etc/rpc
|
||||
removefrom glibc /lib/*/nosegneg/* /${libdir}/libBrokenLocale*
|
||||
removefrom glibc /${libdir}/libSegFault* /${libdir}/libanl*
|
||||
removefrom glibc /${libdir}/libcidn* /${libdir}/libnss_compat*
|
||||
|
@ -51,11 +51,8 @@ installpkg plymouth
|
||||
## extra dracut modules
|
||||
installpkg anaconda-dracut dracut-network dracut-config-generic
|
||||
|
||||
## fedup-dracut handles upgrades
|
||||
installpkg fedup-dracut fedup-dracut-plymouth
|
||||
## install other fedup scripts, if there are any. It's OK if there aren't.
|
||||
log "Looking for extra fedup-dracut packages..."
|
||||
-installpkg *-fedup-dracut
|
||||
## rescue needs this
|
||||
installpkg cryptsetup
|
||||
|
||||
## rpcbind or portmap needed by dracut nfs module
|
||||
installpkg rpcbind
|
||||
@ -96,7 +93,7 @@ installpkg python-nss
|
||||
installpkg selinux-policy-targeted audit libsemanage-python
|
||||
|
||||
## network tools/servers
|
||||
installpkg python-ethtool ethtool openssh-server nfs-utils
|
||||
installpkg python-ethtool ethtool openssh-server nfs-utils openssh-clients
|
||||
installpkg tigervnc-server-minimal
|
||||
%if basearch != "s390x":
|
||||
installpkg tigervnc-server-module
|
||||
|
@ -4,6 +4,7 @@ configdir="tmp/config_files/s390"
|
||||
BOOTDIR="images"
|
||||
KERNELDIR=BOOTDIR
|
||||
INITRD_ADDRESS="0x02000000"
|
||||
LORAXDIR="usr/share/lorax/"
|
||||
# The assumption seems to be that there is only one s390 kernel, ever
|
||||
kernel = kernels[0]
|
||||
%>
|
||||
@ -25,11 +26,6 @@ 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
|
||||
|
||||
%if doupgrade:
|
||||
## upgrader image
|
||||
installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
|
||||
## s390 needs some extra boot config
|
||||
createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
|
||||
|
||||
@ -38,3 +34,19 @@ treeinfo images-${basearch} initrd.addrsize ${BOOTDIR}/initrd.addrsize
|
||||
treeinfo images-${basearch} generic.prm ${BOOTDIR}/generic.prm
|
||||
treeinfo images-${basearch} genericdvd.prm ${BOOTDIR}/genericdvd.prm
|
||||
treeinfo images-${basearch} generic.ins generic.ins
|
||||
|
||||
# Create optional product.img and updates.img
|
||||
<% imggraft=""; images=["product", "updates"] %>
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
@ -44,30 +44,18 @@ mkdir ${KERNELDIR}
|
||||
## i386 PAE
|
||||
installkernel images-xen ${kernel.path} ${KERNELDIR}/vmlinuz-${kernel.flavor}
|
||||
installinitrd images-xen ${kernel.initrd.path} ${KERNELDIR}/initrd-${kernel.flavor}.img
|
||||
%if doupgrade:
|
||||
installupgradeinitrd images-xen ${kernel.upgrade.path} ${KERNELDIR}/upgrade-${kernel.flavor}.img
|
||||
%endif
|
||||
%else:
|
||||
## normal i386, x86_64
|
||||
installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
%if doupgrade:
|
||||
installupgradeinitrd images-${basearch} ${kernel.upgrade.path} ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
hardlink ${KERNELDIR}/vmlinuz ${BOOTDIR}
|
||||
hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
|
||||
%if doupgrade:
|
||||
hardlink ${KERNELDIR}/upgrade.img ${BOOTDIR}
|
||||
%endif
|
||||
%if basearch == 'x86_64':
|
||||
treeinfo images-xen kernel ${KERNELDIR}/vmlinuz
|
||||
treeinfo images-xen initrd ${KERNELDIR}/initrd.img
|
||||
%if doupgrade:
|
||||
treeinfo images-xen upgrade ${KERNELDIR}/upgrade.img
|
||||
%endif
|
||||
%endif
|
||||
|
||||
## WHeeeeeeee, EFI.
|
||||
@ -89,14 +77,25 @@ hardlink ${KERNELDIR}/initrd.img ${BOOTDIR}
|
||||
%endif
|
||||
|
||||
# Create optional product.img and updates.img
|
||||
<% imggraft=""; images=["product", "updates"] %>
|
||||
<% imggraft=""; images=["product", "updates"]; compressargs=None; %>
|
||||
%if basearch == 'i386':
|
||||
# Limit the amount of memory xz uses on i386
|
||||
<% compressargs="--xz -9 --memlimit-compress=3700MiB" %>
|
||||
%endif
|
||||
%for img in images:
|
||||
%if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
installimg ${compressargs} ${LORAXDIR}/${img}/ images/${img}.img
|
||||
<% imggraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
%endif
|
||||
%endfor
|
||||
|
||||
# Inherit iso-graft/ if it exists from external templates
|
||||
<%
|
||||
import os
|
||||
if os.path.exists(workdir + "/iso-graft"):
|
||||
imggraft += " " + workdir + "/iso-graft"
|
||||
%>
|
||||
|
||||
## make boot.iso
|
||||
runcmd mkisofs -o ${outroot}/images/boot.iso \
|
||||
-b ${BOOTDIR}/isolinux.bin -c ${BOOTDIR}/boot.cat \
|
||||
|
@ -155,7 +155,10 @@ class Lorax(BaseLoraxClass):
|
||||
installpkgs=None,
|
||||
size=2,
|
||||
add_templates=None,
|
||||
add_template_vars=None):
|
||||
add_template_vars=None,
|
||||
add_arch_templates=None,
|
||||
add_arch_template_vars=None,
|
||||
template_tempdir=None):
|
||||
|
||||
assert self._configured
|
||||
|
||||
@ -312,7 +315,10 @@ class Lorax(BaseLoraxClass):
|
||||
inroot=installroot, outroot=self.outputdir,
|
||||
runtime=runtime, isolabel=isolabel,
|
||||
domacboot=domacboot, doupgrade=doupgrade,
|
||||
templatedir=templatedir)
|
||||
templatedir=templatedir,
|
||||
add_templates=add_arch_templates,
|
||||
add_template_vars=add_arch_template_vars,
|
||||
workdir=self.workdir)
|
||||
|
||||
logger.info("rebuilding initramfs images")
|
||||
dracut_args = ["--xz", "--install", "/.buildstamp"]
|
||||
@ -328,21 +334,6 @@ class Lorax(BaseLoraxClass):
|
||||
|
||||
treebuilder.rebuild_initrds(add_args=anaconda_args)
|
||||
|
||||
if doupgrade:
|
||||
# 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")
|
||||
|
||||
logger.info("populating output tree and building boot images")
|
||||
treebuilder.build()
|
||||
|
||||
|
@ -175,7 +175,7 @@ class LoraxTemplateRunner(object):
|
||||
def run(self, templatefile, **variables):
|
||||
for k,v in self.defaults.items() + self.builtins.items():
|
||||
variables.setdefault(k,v)
|
||||
logger.debug("parsing %s", templatefile)
|
||||
logger.debug("executing {0} with variables={1}".format(templatefile, variables))
|
||||
self.templatefile = templatefile
|
||||
t = LoraxTemplate(directories=[self.templatedir])
|
||||
commands = t.parse(templatefile, variables)
|
||||
@ -234,9 +234,9 @@ class LoraxTemplateRunner(object):
|
||||
for src in rglob(self._in(srcglob), fatal=True):
|
||||
cpfile(src, self._out(dest))
|
||||
|
||||
def installimg(self, srcdir, destfile):
|
||||
def installimg(self, *args):
|
||||
'''
|
||||
installimg SRCDIR DESTFILE
|
||||
installimg [--xz|--gzip|--bzip2|--lzma] [-ARG|--ARG=OPTION] SRCDIR DESTFILE
|
||||
Create a compressed cpio archive of the contents of SRCDIR and place
|
||||
it in DESTFILE.
|
||||
|
||||
@ -245,11 +245,35 @@ class LoraxTemplateRunner(object):
|
||||
Examples:
|
||||
installimg ${LORAXDIR}/product/ images/product.img
|
||||
installimg ${LORAXDIR}/updates/ images/updates.img
|
||||
installimg --xz -6 ${LORAXDIR}/updates/ images/updates.img
|
||||
installimg --xz -9 --memlimit-compress=3700MiB ${LORAXDIR}/updates/ images/updates.img
|
||||
|
||||
Optionally use a different compression type and override the default args
|
||||
passed to it. The default is xz -9
|
||||
'''
|
||||
COMPRESSORS = ("--xz", "--gzip", "--bzip2", "--lzma")
|
||||
if len(args) < 2:
|
||||
raise ValueError("Not enough args for installimg.")
|
||||
|
||||
srcdir = args[-2]
|
||||
destfile = args[-1]
|
||||
if not os.path.isdir(self._in(srcdir)) or not os.listdir(self._in(srcdir)):
|
||||
return
|
||||
|
||||
compression = "xz"
|
||||
compressargs = []
|
||||
if args[0] in COMPRESSORS:
|
||||
compression = args[0][2:]
|
||||
|
||||
for arg in args[1:-2]:
|
||||
if arg.startswith('-'):
|
||||
compressargs.append(arg)
|
||||
else:
|
||||
raise ValueError("Argument is missing -")
|
||||
|
||||
logger.info("Creating image file %s from contents of %s", self._out(destfile), self._in(srcdir))
|
||||
mkcpio(self._in(srcdir), self._out(destfile))
|
||||
logger.debug("Using %s %s compression", compression, compressargs or "")
|
||||
mkcpio(self._in(srcdir), self._out(destfile), compression=compression, compressargs=compressargs)
|
||||
|
||||
def mkdir(self, *dirs):
|
||||
'''
|
||||
|
@ -172,16 +172,20 @@ class RuntimeBuilder(object):
|
||||
class TreeBuilder(object):
|
||||
'''Builds the arch-specific boot images.
|
||||
inroot should be the installtree root (the newly-built runtime dir)'''
|
||||
def __init__(self, product, arch, inroot, outroot, runtime, isolabel, domacboot=True, doupgrade=True, templatedir=None):
|
||||
def __init__(self, product, arch, inroot, outroot, runtime, isolabel, domacboot=True, doupgrade=True, templatedir=None, add_templates=None, add_template_vars=None, workdir=None):
|
||||
|
||||
# NOTE: if you pass an arg named "runtime" to a mako template it'll
|
||||
# clobber some mako internal variables - hence "runtime_img".
|
||||
self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime,
|
||||
runtime_base=basename(runtime),
|
||||
inroot=inroot, outroot=outroot,
|
||||
basearch=arch.basearch, libdir=arch.libdir,
|
||||
isolabel=isolabel, udev=udev_escape, domacboot=domacboot, doupgrade=doupgrade)
|
||||
isolabel=isolabel, udev=udev_escape, domacboot=domacboot, doupgrade=doupgrade,
|
||||
workdir=workdir)
|
||||
self._runner = LoraxTemplateRunner(inroot, outroot, templatedir=templatedir)
|
||||
self._runner.defaults = self.vars
|
||||
self.add_templates = add_templates or []
|
||||
self.add_template_vars = add_template_vars or {}
|
||||
self.templatedir = templatedir
|
||||
self.treeinfo_data = None
|
||||
|
||||
@ -230,6 +234,8 @@ class TreeBuilder(object):
|
||||
|
||||
def build(self):
|
||||
templatefile = templatemap[self.vars.arch.basearch]
|
||||
for tmpl in self.add_templates:
|
||||
self._runner.run(tmpl, **self.add_template_vars)
|
||||
self._runner.run(templatefile, kernels=self.kernels)
|
||||
self.treeinfo_data = self._runner.results.treeinfo
|
||||
self.implantisomd5()
|
||||
|
@ -56,7 +56,7 @@ from pylorax.treebuilder import findkernels
|
||||
from pylorax.sysutils import joinpaths, remove
|
||||
from pylorax.imgutils import PartitionMount, mksparse, mkext4img, loop_detach
|
||||
from pylorax.imgutils import get_loop_name, dm_detach, mount, umount, Mount
|
||||
from pylorax.imgutils import mksquashfs, mkqcow2, mktar, mkrootfsimg
|
||||
from pylorax.imgutils import mksquashfs, mkqcow2, mktar, mkrootfsimg, copytree
|
||||
from pylorax.executils import execWithRedirect, execWithCapture, runcmd
|
||||
|
||||
# no-virt mode doesn't need libvirt, so make it optional
|
||||
@ -693,7 +693,7 @@ def make_livecd(opts, mount_dir, work_dir):
|
||||
fullpath = joinpaths(mount_dir, configdir_path)
|
||||
if os.path.exists(fullpath):
|
||||
remove(fullpath)
|
||||
shutil.copytree(configdir, fullpath)
|
||||
copytree(configdir, fullpath)
|
||||
|
||||
isolabel = opts.volid or "{0.name}-{0.version}-{1.basearch}".format(product, arch)
|
||||
if len(isolabel) > 32:
|
||||
@ -766,6 +766,23 @@ def novirt_log_check(log_check, proc):
|
||||
return False
|
||||
|
||||
|
||||
def anaconda_cleanup(dirinstall_path):
|
||||
"""
|
||||
Cleanup any leftover mounts from anaconda
|
||||
|
||||
:param str dirinstall_path: Path where anaconda mounts things
|
||||
|
||||
If anaconda crashes it may leave things mounted under this path. It will
|
||||
typically be set to /mnt/sysimage/
|
||||
"""
|
||||
dirinstall_path = os.path.abspath(dirinstall_path)
|
||||
# unmount filesystems
|
||||
for mounted in reversed(open("/proc/mounts").readlines()):
|
||||
(_device, mountpoint, _rest) = mounted.split(" ", 2)
|
||||
if mountpoint.startswith(dirinstall_path):
|
||||
umount(mountpoint)
|
||||
|
||||
|
||||
def novirt_install(opts, disk_img, disk_size, repo_url):
|
||||
"""
|
||||
Use Anaconda to install to a disk image
|
||||
@ -850,6 +867,9 @@ def novirt_install(opts, disk_img, disk_size, repo_url):
|
||||
finally:
|
||||
log_monitor.shutdown()
|
||||
|
||||
# Make sure any leftover anaconda mounts have been cleaned up
|
||||
anaconda_cleanup(ROOT_PATH)
|
||||
|
||||
# Move the anaconda logs over to a log directory
|
||||
log_dir = os.path.abspath(os.path.dirname(opts.logfile))
|
||||
log_anaconda = joinpaths(log_dir, "anaconda")
|
||||
@ -882,7 +902,7 @@ def novirt_install(opts, disk_img, disk_size, repo_url):
|
||||
# convert the image to qcow2 format
|
||||
if "-O" not in qcow2_args:
|
||||
qcow2_args.extend(["-O", "qcow2"])
|
||||
qcow2_img = tempfile.mktemp(prefix="disk", suffix=".img", dir=opts.tmp)
|
||||
qcow2_img = tempfile.mktemp(prefix="disk", suffix=".img")
|
||||
execWithRedirect("qemu-img", ["convert"] + qcow2_args + [disk_img, qcow2_img], raise_err=True)
|
||||
execWithRedirect("mv", ["-f", qcow2_img, disk_img], raise_err=True)
|
||||
elif opts.make_tar:
|
||||
@ -928,7 +948,7 @@ def virt_install(opts, install_log, disk_img, disk_size):
|
||||
mkqcow2(disk_img, disk_size*1024**2, qcow2_args)
|
||||
|
||||
if opts.make_fsimage or opts.make_tar:
|
||||
diskimg_path = tempfile.mktemp(prefix="disk", suffix=".img", dir=opts.tmp)
|
||||
diskimg_path = tempfile.mktemp(prefix="disk", suffix=".img")
|
||||
else:
|
||||
diskimg_path = disk_img
|
||||
|
||||
@ -1013,9 +1033,9 @@ def make_image(opts, ks):
|
||||
log.info("disk_size = %sMiB", disk_size)
|
||||
|
||||
if opts.image_name:
|
||||
disk_img = joinpaths(opts.tmp, opts.image_name)
|
||||
disk_img = joinpaths(opts.result_dir, opts.image_name)
|
||||
else:
|
||||
disk_img = tempfile.mktemp(prefix="disk", suffix=".img", dir=opts.tmp)
|
||||
disk_img = tempfile.mktemp(prefix="disk", suffix=".img", dir=opts.result_dir)
|
||||
log.info("disk_img = %s", disk_img)
|
||||
|
||||
try:
|
||||
@ -1290,6 +1310,12 @@ def main():
|
||||
errors.append("The results_dir (%s) should not exist, please delete or "
|
||||
"move its contents" % opts.result_dir)
|
||||
|
||||
# Default to putting results into tmp
|
||||
if not opts.result_dir:
|
||||
opts.result_dir = opts.tmp
|
||||
else:
|
||||
os.makedirs(opts.result_dir)
|
||||
|
||||
if opts.iso and not os.path.exists(opts.iso):
|
||||
errors.append("The iso %s is missing." % opts.iso)
|
||||
|
||||
@ -1325,7 +1351,7 @@ def main():
|
||||
errors.append("The appliance template (%s) doesn't "
|
||||
"exist" % opts.app_template)
|
||||
|
||||
if opts.image_name and os.path.exists(joinpaths(opts.tmp, opts.image_name)):
|
||||
if opts.image_name and os.path.exists(joinpaths(opts.result_dir, opts.image_name)):
|
||||
errors.append("The disk image to be created should not exist.")
|
||||
|
||||
if opts.qcow2 and not os.path.exists("/usr/bin/qemu-img"):
|
||||
@ -1361,7 +1387,7 @@ def main():
|
||||
opts.compress_args = ["-9"]
|
||||
|
||||
if opts.app_file:
|
||||
opts.app_file = joinpaths(opts.tmp, opts.app_file)
|
||||
opts.app_file = joinpaths(opts.result_dir, opts.app_file)
|
||||
|
||||
if opts.make_ostree_live:
|
||||
opts.make_pxe_live = True
|
||||
@ -1378,6 +1404,12 @@ def main():
|
||||
ks = KickstartParser(ks_version, errorsAreFatal=False, missingIncludeIsFatal=False)
|
||||
ks.readKickstart(opts.ks[0])
|
||||
|
||||
# live iso usually needs dracut-live so warn the user if it is missing
|
||||
if opts.ks and opts.make_iso:
|
||||
if "dracut-live" not in ks.handler.packages.packageList:
|
||||
log.error("dracut-live package is missing from the kickstart.")
|
||||
sys.exit(1)
|
||||
|
||||
# Make the disk or filesystem image
|
||||
if not opts.disk_image and not opts.fs_image:
|
||||
errors = []
|
||||
@ -1473,8 +1505,8 @@ def main():
|
||||
if mounted_sysroot_boot_dir:
|
||||
umount(mounted_sysroot_boot_dir)
|
||||
|
||||
if opts.result_dir and result_dir:
|
||||
shutil.copytree(result_dir, opts.result_dir)
|
||||
if opts.result_dir != opts.tmp and result_dir:
|
||||
copytree(result_dir, opts.result_dir)
|
||||
shutil.rmtree(result_dir)
|
||||
|
||||
log.info("SUMMARY")
|
||||
@ -1484,8 +1516,7 @@ def main():
|
||||
log.info("Disk image is at {0}".format(disk_img))
|
||||
if opts.make_appliance:
|
||||
log.info("Appliance description is in {0}".format(opts.app_file))
|
||||
if result_dir:
|
||||
log.info("Results are in {0}".format(opts.result_dir or result_dir))
|
||||
log.info("Results are in {0}".format(opts.result_dir))
|
||||
|
||||
sys.exit( 0 )
|
||||
|
||||
|
@ -137,10 +137,16 @@ def main(args):
|
||||
optional.add_option("--tmp", default="/var/tmp",
|
||||
help="Top level temporary directory" )
|
||||
optional.add_option("--add-template", dest="add_templates",
|
||||
action="append", help="Additional template to execute",
|
||||
action="append", help="Additional template for runtime image",
|
||||
default=[])
|
||||
optional.add_option("--add-template-var", dest="add_template_vars",
|
||||
action="append", help="Set variable for additional templates",
|
||||
action="append", help="Set variable for runtime image template",
|
||||
default=[])
|
||||
optional.add_option("--add-arch-template", dest="add_arch_templates",
|
||||
action="append", help="Additional template for architecture-specific image",
|
||||
default=[])
|
||||
optional.add_option("--add-arch-template-var", dest="add_arch_template_vars",
|
||||
action="append", help="Set variable for architecture-specific image",
|
||||
default=[])
|
||||
|
||||
# add the option groups to the parser
|
||||
@ -201,6 +207,13 @@ def main(args):
|
||||
raise ValueError("Missing '=' for key=value in " % kv)
|
||||
parsed_add_template_vars[k] = v
|
||||
|
||||
parsed_add_arch_template_vars = {}
|
||||
for kv in opts.add_arch_template_vars:
|
||||
k, t, v = kv.partition('=')
|
||||
if t == '':
|
||||
raise ValueError("Missing '=' for key=value in " % kv)
|
||||
parsed_add_arch_template_vars[k] = v
|
||||
|
||||
# run lorax
|
||||
lorax = pylorax.Lorax()
|
||||
lorax.configure(conf_file=opts.config)
|
||||
@ -211,6 +224,8 @@ def main(args):
|
||||
installpkgs=opts.installpkgs,
|
||||
add_templates=opts.add_templates,
|
||||
add_template_vars=parsed_add_template_vars,
|
||||
add_arch_templates=opts.add_arch_templates,
|
||||
add_arch_template_vars=parsed_add_arch_template_vars,
|
||||
remove_temp=True)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user