From d154f5685501650338ebf804ac6ab5dd6ede2dbb Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Wed, 27 Apr 2011 13:56:47 +0200 Subject: [PATCH 01/60] Use crc32 check when compressing with xz --- src/pylorax/installtree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index f7502ebc..13ae6f15 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -521,7 +521,11 @@ class LoraxInstallTree(BaseLoraxClass): stdin=find.stdout, stdout=subprocess.PIPE, preexec_fn=chdir) - compressed = subprocess.Popen([type, "-%s" % speed], stdin=cpio.stdout, + cmd = [type, "-%s" % speed] + if type == "xz": + cmd.append("--check=crc32") + + compressed = subprocess.Popen(cmd, stdin=cpio.stdout, stdout=open(initrd.fpath, "wb")) logger.debug("compressing") From 7a77fdc7abefe71aa7c427890ff716e87a95ebc2 Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Wed, 27 Apr 2011 15:03:10 +0200 Subject: [PATCH 02/60] Disable rsyslogd rate limiting on imuxsock. Unbelievably, a new rsyslogd version turned on this undesirable feature by default. Related: rhbz#696943 --- share/config_files/rsyslog.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/config_files/rsyslog.conf b/share/config_files/rsyslog.conf index e53ed473..64728b88 100644 --- a/share/config_files/rsyslog.conf +++ b/share/config_files/rsyslog.conf @@ -1,6 +1,7 @@ #### MODULES #### -$ModLoad imuxsock.so # provides support for local system logging -$ModLoad imklog.so # provides kernel logging support +$ModLoad imuxsock.so # provides support for local system logging +$SystemLogRateLimitInterval 0 # disables message dropping, we need all of them +$ModLoad imklog.so # provides kernel logging support $ModLoad imfile $InputFileName /tmp/X.log From 9f4d4aac56314c5bd8c0e901270e6d6b4ec63519 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 2 May 2011 09:26:20 +0200 Subject: [PATCH 03/60] New version --- lorax.spec | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index 8a0094b9..e0b3f47c 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,5 +1,5 @@ Name: lorax -Version: 0.5 +Version: 0.6 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -59,6 +59,22 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Mon May 02 2011 Martin Gracik 0.6-1 +- Disable rsyslogd rate limiting on imuxsock. +- Use crc32 check when compressing with xz +- Allow compression type be specified in lorax.conf +- Use xz and gzip commands instead of libraries +- Add the udf module to the image. +- Preserve anaconda's /usr/bin so anaconda-cleanup is in the image. +- Use arch macros in the lorax.spec +- use reqs not regs for files to backup (dgilmore) +- Reflect changes made in ntfs-3g and ntfsprogs packages (#696706) +- getkeymaps resides in /usr/libexec/anaconda +- workdir is a local variable, not a class attribute +- Add sparcv9 to arch map +- Change the location of *.b files on sparc +- Change BuildRequires to python2-devel + * Wed Apr 13 2011 Martin Gracik 0.5-1 - Remove pungi patch - Remove pseudo code From d483a9c5cc6c2ddf92aa1901f944d24690ffa499 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 3 May 2011 11:11:08 +0200 Subject: [PATCH 04/60] Disable debuginfo package --- lorax.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lorax.spec b/lorax.spec index e0b3f47c..9d5241bd 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,3 +1,5 @@ +%define debug_package %{nil} + Name: lorax Version: 0.6 Release: 1%{?dist} From 83d35dad3240c7010dac63273f93225b0cb53e51 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 3 May 2011 11:11:28 +0200 Subject: [PATCH 05/60] New release --- lorax.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index 9d5241bd..5c4a1341 100644 --- a/lorax.spec +++ b/lorax.spec @@ -2,7 +2,7 @@ Name: lorax Version: 0.6 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for creating the anaconda install images Group: Applications/System From 09a3d7a0e845383cff3736e34bba51c6bbce7e77 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 3 May 2011 11:15:36 +0200 Subject: [PATCH 06/60] New release - added changelog --- lorax.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index 5c4a1341..c963ac28 100644 --- a/lorax.spec +++ b/lorax.spec @@ -2,7 +2,7 @@ Name: lorax Version: 0.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tool for creating the anaconda install images Group: Applications/System @@ -61,6 +61,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Tue May 03 2011 Martin Gracik 0.6-3 +- Disable debuginfo package + * Mon May 02 2011 Martin Gracik 0.6-1 - Disable rsyslogd rate limiting on imuxsock. - Use crc32 check when compressing with xz From 59d298712d35cac88b12c5938b523936cdc9bbbf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 4 May 2011 10:40:05 -0400 Subject: [PATCH 07/60] Use process-specific name for dm devices. If you're doing e.g. an i386 build an an x86_64 build at the same time, you wind up deadlocking the dmsetup processes in sys_semtimedop() because they have the same name between the two codepaths. This is probbaly a dmsetup bug, but even if it weren't, you'd still have two composes trying to use the same dm devices, and that's bad. Instead, stick the pid in the names. --- src/pylorax/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 6e0f3c4c..5eded803 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -689,7 +689,8 @@ class Lorax(BaseLoraxClass): return None # create dm device - dmdev = create_dm_dev("efiboot", disksize / 512, loopdev) + tablename = "efiboot%s" % (os.getpid(),) + dmdev = create_dm_dev(tablename, disksize / 512, loopdev) if not dmdev: remove_loop_dev(loopdev) From 21642aac162c72db3a82681973c84263c2df55b1 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 3 May 2011 15:28:22 +0200 Subject: [PATCH 08/60] Do not remove libproxy (#701622) --- share/ramdisk.ltmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 35b91b18..743d078d 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -268,7 +268,6 @@ remove "libmodman" remove "libmx" remove "libnih" remove "libpcap" -remove "libproxy" remove "librdmacm" remove "librsvg2" remove "libselinux-utils" From 65ca1ce1851debbc283543f02468e99f04bfd92c Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 10 May 2011 12:37:02 +0200 Subject: [PATCH 09/60] Add firmware for Intel Wireless WiFi Link 6030 Adapters (#703291) --- share/ramdisk.ltmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 743d078d..a5ba26f1 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -174,6 +174,7 @@ install "${product}-release" install "iwl5000-firmware" install "iwl5150-firmware" install "iwl6000-firmware" + install "iwl6000g2b-firmware" install "iwl6050-firmware" install "ql2100-firmware" install "ql2200-firmware" From f375dc85072d9b7729c007b170f083d9af875d78 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 10 May 2011 14:45:16 +0200 Subject: [PATCH 10/60] Do not remove libmodman (#701622) --- share/ramdisk.ltmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index a5ba26f1..ede864dc 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -265,7 +265,6 @@ remove "libhbaapi" remove "libhbalinux" remove "libibverbs" remove "libmcpp" -remove "libmodman" remove "libmx" remove "libnih" remove "libpcap" From fe898c07e6789bb69710d348478b4f95fa877c12 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 12 May 2011 11:23:45 +0200 Subject: [PATCH 11/60] Use initrd.addrsize, not initrd_addrsize (#703862) --- src/pylorax/images.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index ece8b008..8cade6ad 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -643,7 +643,7 @@ class S390(object): "anaconda", "addrsize") cmd = [addrsize, INITRD_ADDRESS, initrd.fpath, - joinpaths(self.outputroot, IMAGESDIR, "initrd_addrsize")] + joinpaths(self.outputroot, IMAGESDIR, "initrd.addrsize")] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) @@ -654,7 +654,7 @@ class S390(object): section = "images-{0}".format(kernel_arch) data = {"kernel": joinpaths(IMAGESDIR, kernel.fname), "initrd": joinpaths(IMAGESDIR, initrd.fname), - "initrd.addrsize": joinpaths(IMAGESDIR, "initrd_addrsize"), + "initrd.addrsize": joinpaths(IMAGESDIR, "initrd.addrsize"), "generic.prm": joinpaths(IMAGESDIR, os.path.basename(generic_prm)), "generic.ins": os.path.basename(generic_ins)} From 41dd493274460ef6b1223d4f24e79a9a6ae02612 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 19 May 2011 10:05:38 +0200 Subject: [PATCH 12/60] Install all firmware packages (#705392) --- share/ramdisk.ltmpl | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index ede864dc..a8da0155 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -3,8 +3,12 @@ ## anaconda package install "anaconda" -## kernel +## kernel & firmware install "kernel" +% if basearch != "s390x": + install "*-firmware" +% endif + % if basearch == "i386": install "kernel-PAE" install "gpart" @@ -161,29 +165,6 @@ install "yum-langpacks" install "${product}-logos" install "${product}-release" -## required firmware -% if basearch != "s390x": - install "aic94xx-firmware" - install "ar9170-firmware" - install "atmel-firmware" - install "ipw2100-firmware" - install "ipw2200-firmware" - install "iwl1000-firmware" - install "iwl3945-firmware" - install "iwl4965-firmware" - install "iwl5000-firmware" - install "iwl5150-firmware" - install "iwl6000-firmware" - install "iwl6000g2b-firmware" - install "iwl6050-firmware" - install "ql2100-firmware" - install "ql2200-firmware" - install "ql23xx-firmware" - install "ql2400-firmware" - install "ql2500-firmware" - install "zd1211-firmware" -% endif - ## required directories mkdir "/etc/sysconfig" mkdir "/var/run/dbus" From 6b8fa8447ae01539033323f76827be6b6dbfc5b5 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 9 Jun 2011 13:00:20 -0400 Subject: [PATCH 13/60] refactor: rename "compression speed" -> "compression args" This makes the compression code slightly more generic: - [compression] "speed" config item renamed to "args" - default changed from "9" to "-9" - "cspeed" variables renamed "cargs" - pass "args.split()" on compress cmdline instead of "-%s" % speed --- src/pylorax/__init__.py | 6 +++--- src/pylorax/images.py | 24 ++++++++++++------------ src/pylorax/installtree.py | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 5eded803..d5da4296 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -103,7 +103,7 @@ class Lorax(BaseLoraxClass): self.conf.add_section("compression") self.conf.set("compression", "type", "xz") - self.conf.set("compression", "speed", "9") + self.conf.set("compression", "args", "-9") # read the config file if os.path.isfile(conf_file): @@ -380,7 +380,7 @@ class Lorax(BaseLoraxClass): imgclass = factory.get_class(self.basearch) ctype = self.conf.get("compression", "type") - cspeed = self.conf.get("compression", "speed") + cargs = self.conf.get("compression", "args") i = imgclass(kernellist=self.outputtree.kernels, installtree=self.installtree, @@ -390,7 +390,7 @@ class Lorax(BaseLoraxClass): treeinfo=treeinfo, basearch=self.basearch, ctype=ctype, - cspeed=cspeed) + cargs=cargs) # backup required files i.backup_required(self.workdir) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 8cade6ad..7aae5539 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -79,7 +79,7 @@ SPARCDIR = "boot" class PPC(object): def __init__(self, kernellist, installtree, outputroot, product, version, - treeinfo, basearch, ctype, cspeed): + treeinfo, basearch, ctype, cargs): self.kernellist = kernellist self.installtree = installtree @@ -89,7 +89,7 @@ class PPC(object): self.treeinfo = treeinfo self.basearch = basearch self.ctype = ctype - self.cspeed = cspeed + self.cargs = cargs self.kernels, self.initrds = [], [] self.reqs = collections.defaultdict(str) @@ -178,7 +178,7 @@ class PPC(object): initrd.itype = kernel.ktype logger.info("compressing the install tree") - self.installtree.compress(initrd, kernel, self.ctype, self.cspeed) + self.installtree.compress(initrd, kernel, self.ctype, self.cargs) # add kernel and initrd to the list self.kernels.append(kernel) @@ -361,7 +361,7 @@ class PPC(object): class X86(object): def __init__(self, kernellist, installtree, outputroot, product, version, - treeinfo, basearch, ctype, cspeed): + treeinfo, basearch, ctype, cargs): self.kernellist = kernellist self.installtree = installtree @@ -371,7 +371,7 @@ class X86(object): self.treeinfo = treeinfo self.basearch = basearch self.ctype = ctype - self.cspeed = cspeed + self.cargs = cargs self.kernels, self.initrds = [], [] self.reqs = collections.defaultdict(str) @@ -512,7 +512,7 @@ class X86(object): initrd.itype = kernel.ktype logger.info("compressing the install tree") - self.installtree.compress(initrd, kernel, self.ctype, self.cspeed) + self.installtree.compress(initrd, kernel, self.ctype, self.cargs) # add kernel and initrd to the list self.kernels.append(kernel) @@ -586,7 +586,7 @@ class X86(object): class S390(object): def __init__(self, kernellist, installtree, outputroot, product, version, - treeinfo, basearch, ctype, cspeed): + treeinfo, basearch, ctype, cargs): self.kernellist = kernellist self.installtree = installtree @@ -596,7 +596,7 @@ class S390(object): self.treeinfo = treeinfo self.basearch = basearch self.ctype = ctype - self.cspeed = cspeed + self.cargs = cargs self.kernels, self.initrds = [], [] self.reqs = collections.defaultdict(str) @@ -636,7 +636,7 @@ class S390(object): initrd.fpath = joinpaths(self.outputroot, IMAGESDIR, initrd.fname) logger.info("compressing the install tree") - self.installtree.compress(initrd, kernel, self.ctype, self.cspeed) + self.installtree.compress(initrd, kernel, self.ctype, self.cargs) # run addrsize addrsize = joinpaths(self.installtree.root, "usr/libexec", @@ -685,7 +685,7 @@ class S390(object): class SPARC(object): def __init__(self, kernellist, installtree, outputroot, product, version, - treeinfo, basearch, ctype, cspeed): + treeinfo, basearch, ctype, cargs): self.kernellist = kernellist self.installtree = installtree @@ -695,7 +695,7 @@ class SPARC(object): self.treeinfo = treeinfo self.basearch = basearch self.ctype = ctype - self.cspeed = cspeed + self.cargs = cargs self.kernels, self.initrds = [], [] self.reqs = collections.defaultdict(str) @@ -744,7 +744,7 @@ class SPARC(object): initrd.fpath = joinpaths(self.outputroot, SPARCDIR, initrd.fname) logger.info("compressing the install tree") - self.installtree.compress(initrd, kernel, self.ctype, self.cspeed) + self.installtree.compress(initrd, kernel, self.ctype, self.cargs) # add kernel and initrd to .treeinfo kernel_arch = kernel.version.split(".")[-1] diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 13ae6f15..85019549 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -504,7 +504,7 @@ class LoraxInstallTree(BaseLoraxClass): dst = joinpaths(self.root, "sbin") shutil.copy2(src, dst) - def compress(self, initrd, kernel, type="xz", speed="9"): + def compress(self, initrd, kernel, type="xz", args="-9"): chdir = lambda: os.chdir(self.root) start = time.time() @@ -521,7 +521,7 @@ class LoraxInstallTree(BaseLoraxClass): stdin=find.stdout, stdout=subprocess.PIPE, preexec_fn=chdir) - cmd = [type, "-%s" % speed] + cmd = [type, args.split()] if type == "xz": cmd.append("--check=crc32") From fc000a51e19223f57006d6d3184badc91c31fb0f Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 9 Jun 2011 13:03:04 -0400 Subject: [PATCH 14/60] refactor: split make_initramfs_runtime out of compress() No code changes here. --- src/pylorax/installtree.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 85019549..c3bfda4e 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -505,7 +505,6 @@ class LoraxInstallTree(BaseLoraxClass): shutil.copy2(src, dst) def compress(self, initrd, kernel, type="xz", args="-9"): - chdir = lambda: os.chdir(self.root) start = time.time() # move corresponding modules to the tree @@ -513,6 +512,19 @@ class LoraxInstallTree(BaseLoraxClass): shutil.move(joinpaths(self.workdir, kernel.version), joinpaths(self.root, "modules")) + self.make_initramfs_runtime(initrd, kernel, type, args) + + # move modules out of the tree again + logger.debug("moving modules outside initrd") + shutil.move(joinpaths(self.root, "modules", kernel.version), + self.workdir) + + elapsed = time.time() - start + + return True, elapsed + + def make_initramfs_runtime(self, initrd, kernel, type, args): + chdir = lambda: os.chdir(self.root) find = subprocess.Popen([self.lcmds.FIND, "."], stdout=subprocess.PIPE, preexec_fn=chdir) @@ -531,14 +543,6 @@ class LoraxInstallTree(BaseLoraxClass): logger.debug("compressing") rc = compressed.wait() - # move modules out of the tree again - logger.debug("moving modules outside initrd") - shutil.move(joinpaths(self.root, "modules", kernel.version), - self.workdir) - - elapsed = time.time() - start - - return True, elapsed @property def kernels(self): From d0960bba146f4066ede027a9ea12368ab21ae423 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 9 Jun 2011 13:39:28 -0400 Subject: [PATCH 15/60] Add 'squashfs' compression type This adds the 'squashfs' compression type, which builds runtime images that stay compressed in RAM. It accomplishes this by building the images almost exactly like the Live images are built: 1) Create an empty ext4 filesystem on a large sparse file 2) Copy the runtime files into the ext4 filesystem 3) Place the ext4 image at "LiveOS/rootfs.img" 4) Create a squashfs.img which contains LiveOS/rootfs.img To make this bootable, we need dracut's startup scripts. So before creating the runtime image, we make a dracut initramfs.img by chrooting into the runtime and running dracut. Finally, we add squashfs.img to initramfs.img, along with an extra file (/etc/cmdline) which directs dracut to use /squashfs.img as its root device. And there we go! Easy, right?! --- share/ramdisk.ltmpl | 1 + src/pylorax/__init__.py | 8 ++- src/pylorax/constants.py | 2 + src/pylorax/installtree.py | 99 +++++++++++++++++++++++++++++++++++++- 4 files changed, 107 insertions(+), 3 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index a8da0155..1f73a879 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -161,6 +161,7 @@ install "xorg-x11-fonts-ethiopic" install "xorg-x11-fonts-misc" install "xorg-x11-server-Xorg" install "xorg-x11-server-utils" +install "xz" install "yum-langpacks" install "${product}-logos" install "${product}-release" diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index d5da4296..ff9bf3bb 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -102,8 +102,8 @@ class Lorax(BaseLoraxClass): self.conf.set("yum", "skipbroken", "0") self.conf.add_section("compression") - self.conf.set("compression", "type", "xz") - self.conf.set("compression", "args", "-9") + self.conf.set("compression", "type", "squashfs") + self.conf.set("compression", "args", "-comp xz") # read the config file if os.path.isfile(conf_file): @@ -293,6 +293,10 @@ class Lorax(BaseLoraxClass): logger.info("moving stubs") self.installtree.move_stubs() + if self.conf.get("compression", "type") == "squashfs": + # create dracut initramfs (before stuff gets shuffled/removed) + self.installtree.make_dracut_initramfs() + # get the list of required modules logger.info("getting list of required modules") modules = [f[1:] for f in template if f[0] == "module"] diff --git a/src/pylorax/constants.py b/src/pylorax/constants.py index c37f0db9..09467412 100644 --- a/src/pylorax/constants.py +++ b/src/pylorax/constants.py @@ -48,6 +48,8 @@ class LoraxRequiredCommands(dict): self["LOSETUP"] = "losetup" self["MKDOSFS"] = "mkdosfs" self["MKISOFS"] = "mkisofs" + self["MKFS_EXT4"] = "mkfs.ext4" + self["MKSQUASHFS"] = "mksquashfs" self["MODINFO"] = "modinfo" self["MOUNT"] = "mount" self["PARTED"] = "parted" diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index c3bfda4e..0e49213b 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -46,6 +46,7 @@ class LoraxInstallTree(BaseLoraxClass): self.basearch = basearch self.libdir = libdir self.workdir = workdir + self.initramfs = None self.lcmds = constants.LoraxRequiredCommands() @@ -512,7 +513,10 @@ class LoraxInstallTree(BaseLoraxClass): shutil.move(joinpaths(self.workdir, kernel.version), joinpaths(self.root, "modules")) - self.make_initramfs_runtime(initrd, kernel, type, args) + if type == "squashfs": + self.make_squashfs_runtime(initrd, kernel, type, args) + else: + self.make_initramfs_runtime(initrd, kernel, type, args) # move modules out of the tree again logger.debug("moving modules outside initrd") @@ -543,6 +547,99 @@ class LoraxInstallTree(BaseLoraxClass): logger.debug("compressing") rc = compressed.wait() + def make_dracut_initramfs(self): + outfile = "/tmp/initramfs.img" # inside the chroot + logger.debug("chrooting into installtree to create initramfs.img") + subprocess.check_call(["chroot", self.root, + "/sbin/dracut", "--nomdadmconf", "--nolvmconf", + "--xz", "--modules", "base dmsquash-live", + outfile, self.kernels[0].version]) + # move output file into installtree workdir + self.initramfs = joinpaths(self.workdir, "initramfs.img") + shutil.move(joinpaths(self.root, outfile), self.initramfs) + + def make_squashfs_runtime(self, runtime, kernel, type, args): + """This is a little complicated, but dracut wants to find a squashfs + image named "squashfs.img" which contains a filesystem image named + "LiveOS/rootfs.img". + Placing squashfs.img inside a cpio image and concatenating that + with the existing initramfs.img will make squashfs.img appear inside + initramfs at boot time. + """ + # Check to be sure we have a dracut initramfs to use + assert self.initramfs, "make_dracut_initramfs has not been run!" + + # These exact names are required by dracut + squashname = "squashfs.img" + imgname = "LiveOS/rootfs.img" + + # Create fs image of installtree (2GB sparse file) + fsimage = joinpaths(self.workdir, "installtree.img") + open(fsimage, "wb").truncate(2*1024**3) + mountpoint = joinpaths(self.workdir, "rootfs") + os.mkdir(mountpoint, 0755) + mkfs = [self.lcmds.MKFS_EXT4, "-q", "-L", "Anaconda", "-F", fsimage] + logger.debug("formatting rootfs image: %s" % " ".join(mkfs)) + subprocess.check_call(mkfs, stdout=subprocess.PIPE) + logger.debug("mounting rootfs image at %s", mountpoint) + subprocess.check_call([self.lcmds.MOUNT, "-o", "loop", + fsimage, mountpoint]) + try: + logger.info("copying installtree into rootfs image") + srcfiles = [joinpaths(self.root, f) for f in os.listdir(self.root)] + subprocess.check_call(["cp", "-a"] + srcfiles + [mountpoint]) + finally: + logger.debug("unmounting rootfs image") + rc = subprocess.call([self.lcmds.UMOUNT, mountpoint]) + if rc != 0: + logger.critical("umount %s failed (returncode %i)", mountpoint, rc) + sys.exit(rc) + os.rmdir(mountpoint) + + # Make squashfs with rootfs image inside + logger.info("creating %s containing %s", squashname, imgname) + squashtree = joinpaths(self.workdir, "squashfs") + os.makedirs(joinpaths(squashtree, os.path.dirname(imgname))) + shutil.move(fsimage, joinpaths(squashtree, imgname)) + squashimage = joinpaths(self.workdir, squashname) + cmd = [self.lcmds.MKSQUASHFS, squashtree, squashimage] + args.split() + subprocess.check_call(cmd) + shutil.rmtree(squashtree) + + # Put squashimage in a new initramfs image with dracut config + logger.debug("creating initramfs image containing %s", squashname) + initramfsdir = joinpaths(self.workdir, "initramfs") + # write boot cmdline for dracut + cmdline = joinpaths(initramfsdir, "etc/cmdline") + os.makedirs(os.path.dirname(cmdline)) + with open(cmdline, "wb") as fobj: + fobj.write("root=live:/{0}\n".format(squashname)) + # add squashimage to new cpio image + shutil.move(squashimage, initramfsdir) + # create cpio container + squash_cpio = joinpaths(self.workdir, "squashfs.cpio") + chdir = lambda: os.chdir(initramfsdir) + find = subprocess.Popen([self.lcmds.FIND, "."], stdout=subprocess.PIPE, + preexec_fn=chdir) + cpio = subprocess.Popen([self.lcmds.CPIO, "--quiet", "-c", "-o"], + stdin=find.stdout, + stdout=open(squash_cpio, "wb"), + preexec_fn=chdir) + cpio.communicate() + shutil.rmtree(initramfsdir) + + # create final image + logger.debug("concatenating dracut initramfs and squashfs initramfs") + logger.debug("initramfs.img size = %i", os.stat(self.initramfs).st_size) + with open(runtime.fpath, "wb") as output: + for f in self.initramfs, squash_cpio: + with open(f, "rb") as fobj: + data = fobj.read(4096) + while data: + output.write(data) + data = fobj.read(4096) + os.remove(self.initramfs) + os.remove(squash_cpio) @property def kernels(self): From 7bf9ee4fce084a35cbe800ceb63f13b808180d71 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 9 Jun 2011 18:45:59 -0400 Subject: [PATCH 16/60] Use bcj filter for compressing squashfs ramdisk Using the BCJ filter can shave a few MB off the filesize of our ramdisk at the expense of added CPU time. Worth it. --- src/pylorax/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index ff9bf3bb..394130a5 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -75,6 +75,7 @@ ARCHMAPS = { LIB32 = "lib" LIB64 = "lib64" +bcj = dict(i386="x86", x86_64="x86", ppc="powerpc", sparc="sparc", ia64="ia64") class Lorax(BaseLoraxClass): @@ -104,6 +105,7 @@ class Lorax(BaseLoraxClass): self.conf.add_section("compression") self.conf.set("compression", "type", "squashfs") self.conf.set("compression", "args", "-comp xz") + self.conf.set("compression", "bcj", "on") # read the config file if os.path.isfile(conf_file): @@ -385,6 +387,9 @@ class Lorax(BaseLoraxClass): ctype = self.conf.get("compression", "type") cargs = self.conf.get("compression", "args") + if self.conf.get("compression", "bcj") == "on": + if self.basearch in bcj: + cargs += " -Xbcj %s" % bcj.get(self.basearch) i = imgclass(kernellist=self.outputtree.kernels, installtree=self.installtree, From 19637aa9863839d3fa7fc4635058f764d4549e79 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 24 Jun 2011 13:25:19 +0200 Subject: [PATCH 17/60] New version --- lorax.spec | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lorax.spec b/lorax.spec index c963ac28..f45e4fb0 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,8 +1,8 @@ %define debug_package %{nil} Name: lorax -Version: 0.6 -Release: 3%{?dist} +Version: 0.7 +Release: 1%{?dist} Summary: Tool for creating the anaconda install images Group: Applications/System @@ -61,6 +61,18 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Fri Jun 24 2011 Martin Gracik 0.7-1 +- Use bcj filter for compressing squashfs ramdisk +- Add 'squashfs' compression type +- refactor: split make_initramfs_runtime out of compress() +- refactor: rename "compression speed" -> "compression args" +- Install all firmware packages (#705392) +- Use initrd.addrsize, not initrd_addrsize (#703862) +- Do not remove libmodman (#701622) +- Add firmware for Intel Wireless WiFi Link 6030 Adapters (#703291) +- Do not remove libproxy (#701622) +- Use process-specific name for dm devices. + * Tue May 03 2011 Martin Gracik 0.6-3 - Disable debuginfo package From be1178f4c5e798efe46888bb4a773ad86ae9874c Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 27 Jun 2011 12:31:46 +0200 Subject: [PATCH 18/60] Remove unused code --- src/pylorax/__init__.py | 99 ------------------------------ src/pylorax/outputtree.py | 123 -------------------------------------- 2 files changed, 222 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 394130a5..995b07c9 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -341,13 +341,6 @@ class Lorax(BaseLoraxClass): self.outputtree = LoraxOutputTree(self.outputdir, self.installtree, self.product, self.version) - #self.outputtree.prepare() - #self.outputtree.get_isolinux() - #self.outputtree.get_memtest() - #self.outputtree.get_splash() - #self.outputtree.get_msg_files() - #self.outputtree.get_grub_conf() - # write .discinfo discinfo = DiscInfo(self.workdir, self.release, self.basearch) discinfo.write() @@ -446,47 +439,6 @@ class Lorax(BaseLoraxClass): logger.info("creating the initrd") i.create_initrd(self.libdir) - #initrds = [] - #for kernel in self.outputtree.kernels: - # suffix = "" - # if kernel.ktype == constants.K_PAE: - # suffix = "-PAE" - # elif kernel.ktype == constants.K_XEN: - # suffix = "-XEN" - # - # fname = "initrd{0}.img".format(suffix) - # - # initrd = DataHolder(fname=fname, - # fpath=joinpaths(self.workdir, fname), - # itype=kernel.ktype) - # - # logger.info("compressing install tree ({0})".format(kernel.version)) - # success, elapsed = self.installtree.compress(initrd, kernel) - # if not success: - # logger.error("error while compressing install tree") - # else: - # logger.info("took {0:.2f} seconds".format(elapsed)) - # - # initrds.append(initrd) - # - # # add kernel and initrd paths to .treeinfo - # section = "images-{0}".format("xen" if suffix else self.basearch) - # data = {"kernel": "images/pxeboot/{0}".format(kernel.fname)} - # treeinfo.add_section(section, data) - # data = {"initrd": "images/pxeboot/{0}".format(initrd.fname)} - # treeinfo.add_section(section, data) - # - ## copy initrds to outputtree - #shutil.copy2(initrds[0].fpath, self.outputtree.isolinuxdir) - # - ## create hard link - #source = joinpaths(self.outputtree.isolinuxdir, initrds[0].fname) - #link_name = joinpaths(self.outputtree.pxebootdir, initrds[0].fname) - #os.link(source, link_name) - # - #for initrd in initrds[1:]: - # shutil.copy2(initrd.fpath, self.outputtree.pxebootdir) - # create efi images efiboot = None if grubefi and self.efiarch not in ("IA32",): @@ -538,18 +490,6 @@ class Lorax(BaseLoraxClass): logger.info("creating boot iso") i.create_boot(efiboot) - #bootiso = self.create_bootiso(self.outputtree, efiboot) - #if bootiso is None: - # logger.critical("unable to create boot iso") - # sys.exit(1) - # - #shutil.move(bootiso, self.outputtree.imgdir) - # - ## add the boot.iso - #section = "images-{0}".format(self.basearch) - #data = {"boot.iso": "images/{0}".format(os.path.basename(bootiso))} - #treeinfo.add_section(section, data) - treeinfo.write() shutil.copy2(treeinfo.path, self.outputtree.root) @@ -733,42 +673,3 @@ class Lorax(BaseLoraxClass): remove_loop_dev(loopdev) return efidisk - - def create_bootiso(self, outputtree, efiboot=None): - bootiso = joinpaths(self.workdir, "boot.iso") - if os.path.isfile(bootiso): - os.unlink(bootiso) - - if efiboot is not None: - efiargs = ["-eltorito-alt-boot", "-e", "images/efiboot.img", - "-no-emul-boot"] - efigraft = ["EFI/BOOT={0}".format(outputtree.efibootdir)] - else: - efiargs = [] - efigraft = [] - - cmd = [self.lcmds.MKISOFS, "-o", bootiso, - "-b", "isolinux/isolinux.bin", "-c", "isolinux/boot.cat", - "-no-emul-boot", "-boot-load-size", "4", - "-boot-info-table"] + efiargs + ["-R", "-J", "-V", self.product, - "-T", "-graft-points", - "isolinux={0}".format(outputtree.isolinuxdir), - "images={0}".format(outputtree.imgdir)] + efigraft - logger.debug(cmd) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - retcode = proc.wait() - - if not retcode == 0: - return None - - # create hybrid iso - cmd = [self.lcmds.ISOHYBRID, bootiso] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - retcode = proc.wait() - - # implant iso md5 - cmd = [self.lcmds.IMPLANTISOMD5, bootiso] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - retcode = proc.wait() - - return bootiso diff --git a/src/pylorax/outputtree.py b/src/pylorax/outputtree.py index e37190b8..6e22e8cf 100644 --- a/src/pylorax/outputtree.py +++ b/src/pylorax/outputtree.py @@ -43,28 +43,6 @@ class LoraxOutputTree(BaseLoraxClass): self.product = product self.version = version - def prepare(self): - imgdir = joinpaths(self.root, "images") - os.makedirs(imgdir) - logger.debug("created directory {0}".format(imgdir)) - - pxebootdir = joinpaths(self.root, "images/pxeboot") - os.makedirs(pxebootdir) - logger.debug("created directory {0}".format(pxebootdir)) - - isolinuxdir = joinpaths(self.root, "isolinux") - os.makedirs(isolinuxdir) - logger.debug("created directory {0}".format(isolinuxdir)) - - efibootdir = joinpaths(self.root, "EFI/BOOT") - os.makedirs(efibootdir) - logger.debug("created directory {0}".format(efibootdir)) - - self.imgdir = imgdir - self.pxebootdir = pxebootdir - self.isolinuxdir = isolinuxdir - self.efibootdir = efibootdir - def get_kernels(self, workdir): self.kernels = [] @@ -80,109 +58,8 @@ class LoraxOutputTree(BaseLoraxClass): dst = joinpaths(workdir, kname) shutil.copy2(kernel.fpath, dst) - #if n == 0: - # # copy main kernel to isolinuxdir - # dst = joinpaths(self.isolinuxdir, kname) - # shutil.copy2(kernel.fpath, dst) - # - # # create hard link to main kernel in pxebootdir - # link_name = joinpaths(self.pxebootdir, kname) - # os.link(dst, link_name) - #else: - # # copy other kernels to pxebootdir - # dst = joinpaths(self.pxebootdir, kname) - # shutil.copy2(kernel.fpath, dst) - # change the fname and fpath to new values self.kernels.append(DataHolder(fname=kname, fpath=dst, version=kernel.version, ktype=kernel.ktype)) - - def get_isolinux(self): - isolinuxbin = joinpaths(self.installtree.root, - "usr/share/syslinux/isolinux.bin") - syslinuxcfg = joinpaths(self.installtree.root, - "usr/share/anaconda/boot/syslinux.cfg") - - # copy isolinux.bin - shutil.copy2(isolinuxbin, self.isolinuxdir) - - # copy syslinux.cfg - self.isolinuxcfg = joinpaths(self.isolinuxdir, "isolinux.cfg") - shutil.copy2(syslinuxcfg, self.isolinuxcfg) - - # set product and version in isolinux.cfg - replace(self.isolinuxcfg, r"@PRODUCT@", self.product) - replace(self.isolinuxcfg, r"@VERSION@", self.version) - - def get_memtest(self): - # copy memtest - memtest = joinpaths(self.installtree.root, - "boot/memtest*") - - for fname in glob.glob(memtest): - shutil.copy2(fname, joinpaths(self.isolinuxdir, "memtest")) - - text = """label memtest86 - menu label ^Memory test - kernel memtest - append - - -""" - - with open(self.isolinuxcfg, "a") as fobj: - fobj.write(text) - - break - - def get_splash(self): - vesasplash = joinpaths(self.installtree.root, "usr/share/anaconda", - "boot/syslinux-vesa-splash.jpg") - - vesamenu = joinpaths(self.installtree.root, - "usr/share/syslinux/vesamenu.c32") - - splashtolss = joinpaths(self.installtree.root, - "usr/share/anaconda/splashtolss.sh") - - syslinuxsplash = joinpaths(self.installtree.root, "usr/share/anaconda", - "boot/syslinux-splash.jpg") - - splashlss = joinpaths(self.installtree.root, "usr/share/anaconda", - "boot/splash.lss") - - if os.path.isfile(vesasplash): - shutil.copy2(vesasplash, joinpaths(self.isolinuxdir, "splash.jpg")) - shutil.copy2(vesamenu, self.isolinuxdir) - replace(self.isolinuxcfg, r"default linux", "default vesamenu.c32") - replace(self.isolinuxcfg, r"prompt 1", "#prompt 1") - elif os.path.isfile(splashtolss): - cmd = [splashtolss, syslinuxsplash, splashlss] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - retcode = proc.wait() - if not retcode == 0: - logger.error("failed to create splash.lss") - sys.exit(1) - - if os.path.isfile(splashlss): - shutil.copy2(splashlss, self.isolinuxdir) - - def get_msg_files(self): - msgfiles = joinpaths(self.installtree.root, - "usr/share/anaconda/boot/*.msg") - - for fname in glob.glob(msgfiles): - shutil.copy2(fname, self.isolinuxdir) - path = joinpaths(self.isolinuxdir, os.path.basename(fname)) - replace(path, r"@VERSION@", self.version) - - def get_grub_conf(self): - grubconf = joinpaths(self.installtree.root, - "usr/share/anaconda/boot/grub.conf") - - shutil.copy2(grubconf, self.isolinuxdir) - - grubconf = joinpaths(self.isolinuxdir, "grub.conf") - replace(grubconf, r"@PRODUCT@", self.product) - replace(grubconf, r"@VERSION@", self.version) From 00302d9434d7e0e93283780018256dc6dd7d8c48 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 27 Jun 2011 12:42:57 +0200 Subject: [PATCH 19/60] Remove outputtree.py --- src/pylorax/__init__.py | 47 +++++++++++++++++----------- src/pylorax/outputtree.py | 65 --------------------------------------- 2 files changed, 29 insertions(+), 83 deletions(-) delete mode 100644 src/pylorax/outputtree.py diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 995b07c9..7e61df6b 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -50,7 +50,6 @@ import constants from sysutils import * from installtree import LoraxInstallTree -from outputtree import LoraxOutputTree from buildstamp import BuildStamp from treeinfo import TreeInfo from discinfo import DiscInfo @@ -337,15 +336,11 @@ class Lorax(BaseLoraxClass): # get anaconda portions self.installtree.get_anaconda_portions() - # set up output tree - self.outputtree = LoraxOutputTree(self.outputdir, self.installtree, - self.product, self.version) - # write .discinfo discinfo = DiscInfo(self.workdir, self.release, self.basearch) discinfo.write() - shutil.copy2(discinfo.path, self.outputtree.root) + shutil.copy2(discinfo.path, self.outputdir) # move grubefi to workdir grubefi = joinpaths(self.installtree.root, "boot/efi/EFI/redhat", @@ -368,7 +363,25 @@ class Lorax(BaseLoraxClass): splash = None # copy kernels to output directory - self.outputtree.get_kernels(self.workdir) + self.kernels = [] + + for n, kernel in enumerate(self.installtree.kernels): + suffix = "" + if kernel.ktype == constants.K_PAE: + suffix = "-PAE" + elif kernel.ktype == constants.K_XEN: + suffix = "-XEN" + + kname = "vmlinuz{0}".format(suffix) + + dst = joinpaths(self.workdir, kname) + shutil.copy2(kernel.fpath, dst) + + # change the fname and fpath to new values + self.kernels.append(DataHolder(fname=kname, + fpath=dst, + version=kernel.version, + ktype=kernel.ktype)) # create .treeinfo treeinfo = TreeInfo(self.workdir, self.product, self.version, @@ -384,9 +397,9 @@ class Lorax(BaseLoraxClass): if self.basearch in bcj: cargs += " -Xbcj %s" % bcj.get(self.basearch) - i = imgclass(kernellist=self.outputtree.kernels, + i = imgclass(kernellist=self.kernels, installtree=self.installtree, - outputroot=self.outputtree.root, + outputroot=self.outputdir, product=self.product, version=self.version, treeinfo=treeinfo, @@ -443,13 +456,11 @@ class Lorax(BaseLoraxClass): efiboot = None if grubefi and self.efiarch not in ("IA32",): # create efibootdir - self.outputtree.efibootdir = joinpaths(self.outputtree.root, - "EFI/BOOT") - os.makedirs(self.outputtree.efibootdir) + self.efibootdir = joinpaths(self.outputdir, "EFI/BOOT") + os.makedirs(self.efibootdir) # set imgdir - self.outputtree.imgdir = joinpaths(self.outputtree.root, - "images") + self.imgdir = joinpaths(self.outputdir, "images") kernel = i.kernels[0] initrd = i.initrds[0] @@ -483,8 +494,8 @@ class Lorax(BaseLoraxClass): sys.exit(1) # copy efiboot and efidisk to imgdir - shutil.copy2(efiboot, self.outputtree.imgdir) - shutil.copy2(efidisk, self.outputtree.imgdir) + shutil.copy2(efiboot, self.imgdir) + shutil.copy2(efidisk, self.imgdir) # create boot iso logger.info("creating boot iso") @@ -492,7 +503,7 @@ class Lorax(BaseLoraxClass): treeinfo.write() - shutil.copy2(treeinfo.path, self.outputtree.root) + shutil.copy2(treeinfo.path, self.outputdir) def get_buildarch(self): # get architecture of the available anaconda package @@ -603,7 +614,7 @@ class Lorax(BaseLoraxClass): shutil.copy2(fpath, dst) if not include_kernel: - shutil.copy2(fpath, self.outputtree.efibootdir) + shutil.copy2(fpath, self.efibootdir) # unmount the efiboot image cmd = [self.lcmds.UMOUNT, efibootdir] diff --git a/src/pylorax/outputtree.py b/src/pylorax/outputtree.py deleted file mode 100644 index 6e22e8cf..00000000 --- a/src/pylorax/outputtree.py +++ /dev/null @@ -1,65 +0,0 @@ -# -# outputtree.py -# -# Copyright (C) 2010 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# Red Hat Author(s): Martin Gracik -# - -import logging -logger = logging.getLogger("pylorax.outputtree") - -import sys -import os -import shutil -import glob -import subprocess - -from base import BaseLoraxClass, DataHolder -from sysutils import * -import constants - - -class LoraxOutputTree(BaseLoraxClass): - - def __init__(self, root, installtree, product, version): - BaseLoraxClass.__init__(self) - self.root = root - self.installtree = installtree - - self.product = product - self.version = version - - def get_kernels(self, workdir): - self.kernels = [] - - for n, kernel in enumerate(self.installtree.kernels): - suffix = "" - if kernel.ktype == constants.K_PAE: - suffix = "-PAE" - elif kernel.ktype == constants.K_XEN: - suffix = "-XEN" - - kname = "vmlinuz{0}".format(suffix) - - dst = joinpaths(workdir, kname) - shutil.copy2(kernel.fpath, dst) - - # change the fname and fpath to new values - self.kernels.append(DataHolder(fname=kname, - fpath=dst, - version=kernel.version, - ktype=kernel.ktype)) From 4f57d574a88146369885cbe9b742b6492c74764d Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 27 Jun 2011 12:47:10 +0200 Subject: [PATCH 20/60] Remove check for required commands Not all architectures need all the commands, so the check does not work very well. --- src/pylorax/__init__.py | 7 ------- src/pylorax/constants.py | 11 ----------- 2 files changed, 18 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 7e61df6b..90ed763d 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -173,13 +173,6 @@ class Lorax(BaseLoraxClass): # do we have all lorax required commands? self.lcmds = constants.LoraxRequiredCommands() - """ - missing = self.lcmds.get_missing() - if missing: - logger.critical("missing required command: {0}".format(missing)) - sys.exit(1) - """ - # do we have a proper yum base object? logger.info("checking yum base object") if not isinstance(ybo, yum.YumBase): diff --git a/src/pylorax/constants.py b/src/pylorax/constants.py index 09467412..b5fe307a 100644 --- a/src/pylorax/constants.py +++ b/src/pylorax/constants.py @@ -59,17 +59,6 @@ class LoraxRequiredCommands(dict): def __getattr__(self, attr): return self[attr] - def get_missing(self): - missing = [] - for cmd in self.values(): - found = [joinpaths(path, cmd) for path in self.__path - if os.path.exists(joinpaths(path, cmd))] - - if not found: - missing.append(cmd) - - return missing - # kernel types K_NORMAL = 0 From 23f9879b0ea4fc9c063e0add1ea6ea29b3a8283f Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 27 Jun 2011 13:07:37 +0200 Subject: [PATCH 21/60] Change cjkuni-uming fonts for wgy-microhei (#709962) --- share/ramdisk.ltmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 1f73a879..f4701536 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -60,7 +60,6 @@ install "bind-utils" install "bitmap-fangsongti-fonts" install "btrfs-progs" install "bzip2-libs" -install "cjkuni-uming-fonts" install "dbus-libs" install "dbus-x11" install "dejavu-sans-fonts" @@ -155,6 +154,7 @@ install "vlgothic-fonts" install "volume_key" install "volume_key-libs" install "wget" +install "wqy-microhei-fonts" install "xfsprogs" install "xorg-x11-drivers" install "xorg-x11-fonts-ethiopic" From d9e9b0e57ce5677080dc6b10320bc5f7b264a3b5 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 18 Jul 2011 13:48:56 +0200 Subject: [PATCH 22/60] Create dracut initramfs for each kernel (#722466) --- src/pylorax/__init__.py | 2 +- src/pylorax/installtree.py | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 90ed763d..5c891778 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -305,7 +305,7 @@ class Lorax(BaseLoraxClass): logger.info("compressing modules") self.installtree.compress_modules(kernel) - logger.info("running depmod") + logger.info("running depmod for kernel %s" % kernel.version) self.installtree.run_depmod(kernel) # move repos diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 0e49213b..a004e73b 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -46,7 +46,7 @@ class LoraxInstallTree(BaseLoraxClass): self.basearch = basearch self.libdir = libdir self.workdir = workdir - self.initramfs = None + self.initramfs = {} self.lcmds = constants.LoraxRequiredCommands() @@ -548,15 +548,19 @@ class LoraxInstallTree(BaseLoraxClass): rc = compressed.wait() def make_dracut_initramfs(self): - outfile = "/tmp/initramfs.img" # inside the chroot - logger.debug("chrooting into installtree to create initramfs.img") - subprocess.check_call(["chroot", self.root, - "/sbin/dracut", "--nomdadmconf", "--nolvmconf", - "--xz", "--modules", "base dmsquash-live", - outfile, self.kernels[0].version]) - # move output file into installtree workdir - self.initramfs = joinpaths(self.workdir, "initramfs.img") - shutil.move(joinpaths(self.root, outfile), self.initramfs) + for kernel in self.kernels: + outfile = "/tmp/initramfs.img" # inside the chroot + logger.debug("chrooting into installtree to create initramfs.img") + subprocess.check_call(["chroot", self.root, "/sbin/dracut", + "--nomdadmconf", "--nolvmconf", + "--xz", "--modules", "base dmsquash-live", + outfile, kernel.version]) + # move output file into installtree workdir + dstdir = joinpaths(self.workdir, kernel.version) + os.makedirs(dstdir) + self.initramfs[kernel.version] = joinpaths(dstdir, "initramfs.img") + shutil.move(joinpaths(self.root, outfile), + self.initramfs[kernel.version]) def make_squashfs_runtime(self, runtime, kernel, type, args): """This is a little complicated, but dracut wants to find a squashfs @@ -567,7 +571,8 @@ class LoraxInstallTree(BaseLoraxClass): initramfs at boot time. """ # Check to be sure we have a dracut initramfs to use - assert self.initramfs, "make_dracut_initramfs has not been run!" + assert self.initramfs.get(kernel.version), \ + "no dracut initramfs for kernel %s" % kernel.version # These exact names are required by dracut squashname = "squashfs.img" @@ -630,15 +635,16 @@ class LoraxInstallTree(BaseLoraxClass): # create final image logger.debug("concatenating dracut initramfs and squashfs initramfs") - logger.debug("initramfs.img size = %i", os.stat(self.initramfs).st_size) + logger.debug("initramfs.img size = %i", + os.stat(self.initramfs[kernel.version]).st_size) with open(runtime.fpath, "wb") as output: - for f in self.initramfs, squash_cpio: + for f in self.initramfs[kernel.version], squash_cpio: with open(f, "rb") as fobj: data = fobj.read(4096) while data: output.write(data) data = fobj.read(4096) - os.remove(self.initramfs) + os.remove(self.initramfs[kernel.version]) os.remove(squash_cpio) @property From 43801291efc6727e3b23efb2af150f5499c83ff4 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 18 Jul 2011 16:45:35 +0200 Subject: [PATCH 23/60] Do not remove ntfsprogs (#722711) --- share/ramdisk.ltmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index f4701536..44fcb0ba 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -1007,7 +1007,6 @@ remove "ntfs-3g" "/bin/ntfsmount" remove "ntfs-3g" "/sbin/mount.lowntfs-3g" remove "ntfs-3g" "/usr/share/hal/*" remove "ntfs-3g" "/usr/bin/*" -remove "ntfsprogs" "/sbin/*" remove "openldap" "/etc/openldap/*" remove "openldap" "/usr/${libdir}/libldap_r-*" remove "openldap" "/usr/${libdir}/libldap_r-*" From 01c026e237312bb4c01e42ac235d1d0a1664c7d2 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 19 Jul 2011 09:15:19 +0200 Subject: [PATCH 24/60] Don't change the installroot (#722481) --- src/pylorax/yumhelper.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/pylorax/yumhelper.py b/src/pylorax/yumhelper.py index d0f9087d..04ad1402 100644 --- a/src/pylorax/yumhelper.py +++ b/src/pylorax/yumhelper.py @@ -41,12 +41,6 @@ class LoraxYumHelper(object): def __init__(self, ybo): self.ybo = ybo - - # create our own installroot, the pungi one may be poluted - installroot = joinpaths(self.ybo.conf.installroot, "installroot") - os.makedirs(installroot) - self.ybo.conf.installroot = installroot - self.installroot = self.ybo.conf.installroot self.installed_packages = self.get_packages("installed") From b0ff70a877148ab2ede812f1371d6c339fb31772 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 19 Jul 2011 09:18:41 +0200 Subject: [PATCH 25/60] Prepend dracut to the temporary initramfs directory (#722999) Temporary directory with just the kernel version interferes with the modules temporary directory. --- src/pylorax/installtree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index a004e73b..11a23909 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -556,7 +556,7 @@ class LoraxInstallTree(BaseLoraxClass): "--xz", "--modules", "base dmsquash-live", outfile, kernel.version]) # move output file into installtree workdir - dstdir = joinpaths(self.workdir, kernel.version) + dstdir = joinpaths(self.workdir, "dracut-%s" % kernel.version) os.makedirs(dstdir) self.initramfs[kernel.version] = joinpaths(dstdir, "initramfs.img") shutil.move(joinpaths(self.root, outfile), From 351e5cbae844b9337e65358f5d950cf417abb5da Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 19 Jul 2011 14:03:38 +0200 Subject: [PATCH 26/60] New version Change versioning --- lorax.spec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index f45e4fb0..1463c81d 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: lorax -Version: 0.7 +Version: 16.0 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -61,6 +61,16 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Tue Jul 19 2011 Martin Gracik 16.0-1 +- Prepend dracut to the temporary initramfs directory (#722999) +- Don't change the installroot (#722481) +- Do not remove ntfsprogs (#722711) +- Create dracut initramfs for each kernel (#722466) +- Change cjkuni-uming fonts for wgy-microhei (#709962) +- Remove check for required commands +- Remove outputtree.py +- Remove unused code + * Fri Jun 24 2011 Martin Gracik 0.7-1 - Use bcj filter for compressing squashfs ramdisk - Add 'squashfs' compression type From df849d341927061b633dffc6101f2f4cb0342681 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 21 Jul 2011 16:19:17 +0200 Subject: [PATCH 27/60] Default to isBeta --- src/pylorax/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 5c891778..6274c61e 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -140,7 +140,7 @@ class Lorax(BaseLoraxClass): logger.addHandler(fh) def run(self, ybo, product, version, release, variant="", bugurl="", - is_beta=False, workdir=None, outputdir=None): + is_beta=True, workdir=None, outputdir=None): assert self._configured From 010bedbbb7be9f636debae39368d5a70eb1a5fa8 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 21 Jul 2011 16:46:43 +0200 Subject: [PATCH 28/60] New version --- lorax.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index 1463c81d..7952c434 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: lorax -Version: 16.0 +Version: 16.1 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -61,6 +61,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Thu Jul 21 2011 Martin Gracik 16.1-1 +- Default to isBeta (#723901) + * Tue Jul 19 2011 Martin Gracik 16.0-1 - Prepend dracut to the temporary initramfs directory (#722999) - Don't change the installroot (#722481) From d0fc111ac4afd028799a8683fd5a6e9a9194298b Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 25 Jul 2011 10:38:10 +0200 Subject: [PATCH 29/60] Change IsBeta to IsFinal --- src/pylorax/__init__.py | 8 ++++---- src/pylorax/buildstamp.py | 6 +++--- src/sbin/lorax | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 6274c61e..8eb6c7fa 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -140,7 +140,7 @@ class Lorax(BaseLoraxClass): logger.addHandler(fh) def run(self, ybo, product, version, release, variant="", bugurl="", - is_beta=True, workdir=None, outputdir=None): + isfinal=False, workdir=None, outputdir=None): assert self._configured @@ -217,10 +217,10 @@ class Lorax(BaseLoraxClass): # set up optional build parameters self.variant = variant self.bugurl = bugurl - self.is_beta = is_beta + self.isfinal = isfinal logger.debug("set variant = {0.variant}".format(self)) logger.debug("set bugurl = {0.bugurl}".format(self)) - logger.debug("set is_beta = {0.is_beta}".format(self)) + logger.debug("set isfinal = {0.isfinal}".format(self)) # parse the template logger.info("parsing the template") @@ -258,7 +258,7 @@ class Lorax(BaseLoraxClass): # write .buildstamp buildstamp = BuildStamp(self.workdir, self.product, self.version, - self.bugurl, self.is_beta, self.buildarch) + self.bugurl, self.isfinal, self.buildarch) buildstamp.write() shutil.copy2(buildstamp.path, self.installtree.root) diff --git a/src/pylorax/buildstamp.py b/src/pylorax/buildstamp.py index 20b62130..97f0477b 100644 --- a/src/pylorax/buildstamp.py +++ b/src/pylorax/buildstamp.py @@ -28,13 +28,13 @@ from sysutils import joinpaths class BuildStamp(object): - def __init__(self, workdir, product, version, bugurl, is_beta, buildarch): + def __init__(self, workdir, product, version, bugurl, isfinal, buildarch): self.path = joinpaths(workdir, ".buildstamp") self.product = product self.version = version self.bugurl = bugurl - self.is_beta = is_beta + self.isfinal = isfinal now = datetime.datetime.now() now = now.strftime("%Y%m%d%H%M") @@ -47,5 +47,5 @@ class BuildStamp(object): fobj.write("Product={0.product}\n".format(self)) fobj.write("Version={0.version}\n".format(self)) fobj.write("BugURL={0.bugurl}\n".format(self)) - fobj.write("IsBeta={0.is_beta}\n".format(self)) + fobj.write("IsFinal={0.isfinal}\n".format(self)) fobj.write("UUID={0.uuid}\n".format(self)) diff --git a/src/sbin/lorax b/src/sbin/lorax index 3096fa5d..a056f3e7 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -48,7 +48,7 @@ def main(args): required.add_option("-r", "--release", help="release information", metavar="STRING") required.add_option("-s", "--source", - help="source repository (may be listed multibple times)", + help="source repository (may be listed multiple times)", metavar="REPOSITORY", action="append", default=[]) # optional arguments @@ -61,8 +61,8 @@ def main(args): optional.add_option("-b", "--bugurl", help="bug reporting URL for the product", metavar="URL", default="your distribution provided bug reporting tool") - optional.add_option("--isbeta", help="", - action="store_true", default=False, dest="is_beta") + optional.add_option("--isfinal", help="", + action="store_true", default=False) # add the option groups to the parser parser.add_option_group(required) @@ -110,7 +110,7 @@ def main(args): lorax = pylorax.Lorax() lorax.configure() lorax.run(yb, opts.product, opts.version, opts.release, - opts.variant, opts.bugurl, opts.is_beta, + opts.variant, opts.bugurl, opts.isfinal, workdir=tempdir, outputdir=outputdir) From 6e891f78931d606a14b43289b9e6ee2ce81675bd Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 26 Jul 2011 09:41:01 +0200 Subject: [PATCH 30/60] New version --- lorax.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index 7952c434..ce326b56 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: lorax -Version: 16.1 +Version: 16.2 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -61,6 +61,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Tue Jul 26 2011 Martin Gracik 16.2-1 +- Change IsBeta to IsFinal + * Thu Jul 21 2011 Martin Gracik 16.1-1 - Default to isBeta (#723901) From ba245b1e115ab16ebe13ce4f50d91381146d4bdf Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 26 Jul 2011 10:04:50 +0200 Subject: [PATCH 31/60] Do not remove vmmouse binaries (#723831) --- share/ramdisk.ltmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 44fcb0ba..8e62b342 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -1194,7 +1194,6 @@ remove "xkeyboard-config" "/usr/share/locale/*" remove "xorg-x11-drv-intel" "/usr/${libdir}/libI*" remove "xorg-x11-drv-openchrome" "/usr/${libdir}/libchrome*" remove "xorg-x11-drv-synaptics" "/usr/bin/*" -remove "xorg-x11-drv-vmmouse" "/usr/bin/*" remove "xorg-x11-drv-wacom" "/usr/bin/*" remove "xorg-x11-fonts-ethiopic" "/etc/X11/*" remove "xorg-x11-fonts-ethiopic" "/usr/share/X11/fonts/OTF/*" From fb15fbd4bb4068735301375602bbb85b7b0c2ecc Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 26 Jul 2011 10:07:51 +0200 Subject: [PATCH 32/60] Remove the sysvinit-tools removals from the template sysvinit-tools should not be installed at all. Not needed for systemd. --- share/ramdisk.ltmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 8e62b342..a2c70ccf 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -1100,8 +1100,6 @@ remove "systemd-units" "/lib/systemd/system/*plymouth*" remove "systemd-units" "/lib/systemd/system/quota*" remove "systemd-units" "/lib/systemd/system/smartcard*" remove "systemd-units" "/lib/systemd/system/systemd-remount-api-vfs.service" -remove "sysvinit-tools" "/bin/*" -remove "sysvinit-tools" "/usr/bin/*" remove "tar" "/usr/share/locale/*" remove "un-core-dotum-fonts" "/usr/share/fonts/un-core/UnDotumBold.ttf" remove "usbutils" "/usr/bin/*" From 1484b568b5156163ae01c3571e7cc2f4ac644905 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 26 Jul 2011 13:13:01 +0200 Subject: [PATCH 33/60] New version --- lorax.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index ce326b56..aa59109d 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: lorax -Version: 16.2 +Version: 16.3 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -61,6 +61,10 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Tue Jul 26 2011 Martin Gracik 16.3-1 +- Remove the sysvinit-tools removals from the template +- Do not remove vmmouse binaries (#723831) + * Tue Jul 26 2011 Martin Gracik 16.2-1 - Change IsBeta to IsFinal From 03c317a8295d6e50ed4525189f3fceb22ce49aa6 Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Tue, 26 Jul 2011 13:57:36 +0200 Subject: [PATCH 34/60] Add nss libraries to the image. Related: rhbz#696696 --- share/ramdisk.ltmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index a2c70ccf..b8aa6d0b 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -117,6 +117,7 @@ install "mt-st" install "mtr" install "nfs-utils" install "notification-daemon" +install "nss" install "ntfs-3g" install "openssh-server" install "pciutils" From 12e61f450365255bca5b382e1423f3bb2ef74279 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 26 Jul 2011 14:15:51 +0200 Subject: [PATCH 35/60] New version --- lorax.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lorax.spec b/lorax.spec index aa59109d..cffea112 100644 --- a/lorax.spec +++ b/lorax.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: lorax -Version: 16.3 +Version: 16.4 Release: 1%{?dist} Summary: Tool for creating the anaconda install images @@ -61,6 +61,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %changelog +* Tue Jul 26 2011 Martin Gracik 16.4-1 +- Add nss libraries to the image. + * Tue Jul 26 2011 Martin Gracik 16.3-1 - Remove the sysvinit-tools removals from the template - Do not remove vmmouse binaries (#723831) From 4271e0fc02eb3553f1056756a9035c285a2dd09f Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 29 Jul 2011 14:08:03 +0200 Subject: [PATCH 36/60] Write the lorax verion in the .buildstamp (#689697) --- Makefile | 3 ++- setup.py | 15 ++++++++++++++- src/pylorax/buildstamp.py | 10 ++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 66b1b00f..f1a2f840 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ all: $(PYTHON) setup.py build install: all + @echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/version.py $(PYTHON) setup.py install --root=$(DESTDIR) clean: @@ -28,7 +29,7 @@ archive: tag local: @rm -rf $(PKGNAME)-$(VERSION).tar.bz2 - @rm -rf /tmp/$(PKGNAME)-$(VERSION) /tmp/$(PKGNAME) + @rm -rf /tmp/$(PKGNAME)-$(VERSION) @dir=$$PWD; cp -a $$dir /tmp/$(PKGNAME)-$(VERSION) @rm -rf /tmp/$(PKGNAME)-$(VERSION)/.git @dir=$$PWD; cd /tmp; tar --bzip2 -cSpf $$dir/$(PKGNAME)-$(VERSION).tar.bz2 $(PKGNAME)-$(VERSION) diff --git a/setup.py b/setup.py index e0266512..5b710f0d 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from distutils.core import setup from glob import glob import os +import sys # config file @@ -17,8 +18,20 @@ for root, dnames, fnames in os.walk("share"): # executable data_files.append(("/usr/sbin", ["src/sbin/lorax"])) +# get the version +sys.path.insert(0, "src") +try: + import pylorax.version +except ImportError: + vernum = "devel" +else: + vernum = pylorax.version.num +finally: + sys.path = sys.path[1:] + + setup(name="lorax", - version="0.1", + version=vernum, description="Lorax", long_description="", author="Martin Gracik", diff --git a/src/pylorax/buildstamp.py b/src/pylorax/buildstamp.py index 97f0477b..0c06ce54 100644 --- a/src/pylorax/buildstamp.py +++ b/src/pylorax/buildstamp.py @@ -41,6 +41,14 @@ class BuildStamp(object): self.uuid = "{0}.{1}".format(now, buildarch) def write(self): + # get lorax version + try: + import pylorax.version + except ImportError: + vernum = "devel" + else: + vernum = pylorax.version.num + logger.info("writing .buildstamp file") with open(self.path, "w") as fobj: fobj.write("[Main]\n") @@ -49,3 +57,5 @@ class BuildStamp(object): fobj.write("BugURL={0.bugurl}\n".format(self)) fobj.write("IsFinal={0.isfinal}\n".format(self)) fobj.write("UUID={0.uuid}\n".format(self)) + fobj.write("[Compose]\n") + fobj.write("Lorax={0}\n".format(vernum)) From 9a431dbbe8c146048dc8061747533c83b1603ad0 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 12 Aug 2011 09:28:29 +0200 Subject: [PATCH 37/60] Add libreport required packages (#729537) --- share/ramdisk.ltmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index b8aa6d0b..e50be533 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -132,6 +132,11 @@ install "python-imaging" install "python-volume_key" install "rdate" install "reiserfs-utils" +install "libreport-gtk" +install "libreport-newt" +install "libreport-plugin-bugzilla" +install "libreport-plugin-reportuploader" +install "libreport-python" install "rsh" install "rsync" install "rsyslog" From 31c6f40c7b331e711360d7b068df28f9cbbae12a Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 15 Aug 2011 09:16:02 +0200 Subject: [PATCH 38/60] Remove dogtail from the image, as it's blocking tree composition. (clumens) Related: rhbz#726743 --- share/ramdisk.ltmpl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index e50be533..18801401 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -64,7 +64,6 @@ install "dbus-libs" install "dbus-x11" install "dejavu-sans-fonts" install "dejavu-sans-mono-fonts" -install "dogtail" install "dump" install "ethtool" install "fedora-gnome-theme" @@ -653,10 +652,6 @@ remove "dhclient" "/usr/*" remove "dmz-cursor-themes" "/usr/share/icons/dmz/*" remove "dnsmasq" "/etc/rc.d/*" remove "dnsmasq" "/usr/sbin/*" -remove "dogtail" "/usr/bin/*" -remove "dogtail" "/usr/share/applications/*" -remove "dogtail" "/usr/share/dogtail/*" -remove "dogtail" "/usr/share/icons/*" remove "dosfstools" "/sbin/dosfsck" remove "dosfstools" "/sbin/fsck.*" remove "dump" "/etc/*" From 5d74abb726a4df980a1190834ce6741ae567d96e Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 15 Aug 2011 09:19:17 +0200 Subject: [PATCH 39/60] Do not remove nss certificates (#730438) libreport needs them to be able to file bugreports. --- share/ramdisk.ltmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 18801401..99cbe33a 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -288,7 +288,6 @@ remove "net-snmp-perl" remove "net-snmp-utils" remove "netcf-libs" remove "nfs-utils-lib" -remove "nss-sysinit" remove "nss-tools" remove "ntp" remove "numactl" @@ -1000,7 +999,6 @@ remove "nfs-utils" "/var/lib/nfs/xtab" remove "notification-daemon" "/usr/${libdir}/*" remove "notification-daemon" "/usr/libexec/*" remove "notification-daemon" "/usr/share/locale/*" -remove "nss" "/etc/pki/*" remove "nss-softokn" "/usr/${libdir}/nss/*" remove "ntfs-3g" "/bin/lowntfs-3g" remove "ntfs-3g" "/bin/ntfs-3g.*" From 7d4cc255b969d27a22d51881bf6e69d37a11c3ae Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 16 Aug 2011 09:16:41 +0200 Subject: [PATCH 40/60] Do not remove the fedora-release packages --- share/ramdisk.ltmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 99cbe33a..f6772a0c 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -209,8 +209,6 @@ remove "device-mapper-event" remove "diffutils" remove "dmraid-events" remove "dracut" -remove "fedora-release" -remove "fedora-release-rawhide" remove "fence-agents" remove "fence-virt" remove "file" From 888f33c9d1ba2b69ad6ef89c69dc74ec3aeec0ca Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Wed, 17 Aug 2011 09:23:46 +0200 Subject: [PATCH 41/60] Use --noprefix when calling dracut Do not prefix initramfs files with /run/initramfs when creating the dracut initramfs. --- src/pylorax/installtree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 11a23909..e0ddd9a4 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -552,7 +552,7 @@ class LoraxInstallTree(BaseLoraxClass): outfile = "/tmp/initramfs.img" # inside the chroot logger.debug("chrooting into installtree to create initramfs.img") subprocess.check_call(["chroot", self.root, "/sbin/dracut", - "--nomdadmconf", "--nolvmconf", + "--noprefix", "--nomdadmconf", "--nolvmconf", "--xz", "--modules", "base dmsquash-live", outfile, kernel.version]) # move output file into installtree workdir From 43be129a4821e812f74f09f3126e13dee70b7fd0 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Wed, 24 Aug 2011 08:38:59 +0200 Subject: [PATCH 42/60] Raise an exception if isohybrid cannot be run on x86 --- src/pylorax/images.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 7aae5539..75d38e06 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -569,11 +569,14 @@ class X86(object): stdout=subprocess.PIPE) p.wait() - if os.path.exists(ISOHYBRID): + try: # run isohybrid cmd = [ISOHYBRID, boot_fpath] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + except OSError as e: + raise Exception("cannot run isohybrid: %s" % e) + else: p.wait() # run implantisomd5 From 536c6a0755a228fe405df8c2d89ab34d2a939cf9 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 25 Aug 2011 10:11:30 +0200 Subject: [PATCH 43/60] Do not remove ModemManager files (#727946) --- share/ramdisk.ltmpl | 3 --- 1 file changed, 3 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index f6772a0c..9d1068df 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -511,9 +511,6 @@ remove "GConf2" "/usr/libexec/gconf-defaults-mechanism" remove "GConf2" "/usr/share/GConf/*" remove "GConf2" "/usr/share/locale/*" remove "GConf2" "/usr/share/sgml/*" -remove "ModemManager" "/usr/${libdir}/*" -remove "ModemManager" "/usr/sbin/*" -remove "ModemManager" "/usr/share/icons/*" remove "NetworkManager" "/etc/rc.d/*" remove "NetworkManager" "/usr/bin/*" remove "NetworkManager" "/usr/share/NetworkManager/*" From 171497fdaa545b791208f04fff30ea3f7fb2f03b Mon Sep 17 00:00:00 2001 From: David Lehman Date: Thu, 18 Aug 2011 09:57:02 -0500 Subject: [PATCH 44/60] Remove fedora-storage-init so it can't start raid/lvm. (#729640) --- share/ramdisk.ltmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 9d1068df..b0201839 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -838,6 +838,7 @@ remove "hwdata" "/usr/share/hwdata/oui.txt" remove "hwdata" "/usr/share/hwdata/pnp.ids" remove "hwdata" "/usr/share/hwdata/upgradelist" remove "initscripts" "/etc/ppp/*" +remove "initscripts" "/lib/systemd/fedora-storage-init" remove "initscripts" "/lib/systemd/system/fedora-readonly.service" remove "initscripts" "/lib/systemd/system/fedora-storage-init.service" remove "initscripts" "/lib/systemd/system/fedora-wait-storage.service" From 57845e75253a2a5c56c31a265ba0de5022650684 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 26 Aug 2011 10:22:11 +0200 Subject: [PATCH 45/60] Do not remove xorg-x11-xauth and libXmu (#731046) These packages are needed when installing over ssh -X on s390 --- share/ramdisk.ltmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index b0201839..bba5506d 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -232,7 +232,6 @@ remove "json-glib" remove "kbd-misc" remove "libIDL" remove "libXScrnSaver" -remove "libXmu" remove "libXres" remove "libXt" remove "libXv" @@ -340,7 +339,6 @@ remove "xen-licenses" remove "xml-common" remove "xorg-x11-font-utils" remove "xorg-x11-server-common" -remove "xorg-x11-xauth" remove "xorg-x11-xinit" remove "yajl" remove "yum-utils" From c3e3004c4733375594d3b2b6671ac99236e64ff0 Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Tue, 13 Sep 2011 10:43:25 +0200 Subject: [PATCH 46/60] Log how we run mkisofs. It's very useful to know when trying to rebuild the iso manually. --- src/pylorax/images.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 75d38e06..23b6059c 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -344,6 +344,7 @@ class PPC(object): "-magic", joinpaths(self.installtree.root, MAGIC), "-no-desktop", "-allow-multidot", "-graft-points", isopathdir] + logger.debug("calling mkisofs: %s" % cmd) p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.wait() @@ -565,6 +566,7 @@ class X86(object): "images={0}".format(joinpaths(self.outputroot, IMAGESDIR))] + \ efigraft + logger.debug("calling mkisofs: %s" % cmd) p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.wait() @@ -780,6 +782,7 @@ class SPARC(object): "-o", bootiso_fpath, "-graft-points", "boot=%s" % joinpaths(self.outputroot, SPARCDIR)] + logger.debug("calling mkisofs: %s" % cmd) p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) From b3301595bc2f047472c59b82ea5432a5c6f1d515 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 9 Sep 2011 12:25:35 +0200 Subject: [PATCH 47/60] New syslinux theme (#734170) --- share/config_files/isolinux.cfg | 107 ++++++++++++++++++++++++++++++++ src/pylorax/images.py | 29 ++++----- src/pylorax/installtree.py | 4 ++ 3 files changed, 123 insertions(+), 17 deletions(-) create mode 100644 share/config_files/isolinux.cfg diff --git a/share/config_files/isolinux.cfg b/share/config_files/isolinux.cfg new file mode 100644 index 00000000..6cd18dcb --- /dev/null +++ b/share/config_files/isolinux.cfg @@ -0,0 +1,107 @@ +default vesamenu.c32 +timeout 600 + +display boot.msg + +# Clear the screen when exiting the menu, instead of leaving the menu displayed. +# For vesamenu, this means the graphical background is still displayed without +# the menu itself for as long as the screen remains in graphics mode. +menu clear +menu background splash.png +menu title @PRODUCT@ @VERSION@ +menu vshift 8 +menu rows 18 +menu margin 8 +#menu hidden +menu helpmsgrow 15 +menu tabmsgrow 13 + +# Border Area +menu color border * #00000000 #00000000 none + +# Selected item +menu color sel 0 #ffffffff #00000000 none + +# Title bar +menu color title 0 #ff7ba3d0 #00000000 none + +# Press [Tab] message +menu color tabmsg 0 #ff3a6496 #00000000 none + +# Unselected menu item +menu color unsel 0 #84b8ffff #00000000 none + +# Selected hotkey +menu color hotsel 0 #84b8ffff #00000000 none + +# Unselected hotkey +menu color hotkey 0 #ffffffff #00000000 none + +# Help text +menu color help 0 #ffffffff #00000000 none + +# A scrollbar of some type? Not sure. +menu color scrollbar 0 #ffffffff #ff355594 none + +# Timeout msg +menu color timeout 0 #ffffffff #00000000 none +menu color timeout_msg 0 #ffffffff #00000000 none + +# Command prompt text +menu color cmdmark 0 #84b8ffff #00000000 none +menu color cmdline 0 #ffffffff #00000000 none + +# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. + +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 or upgrade @PRODUCT@ + menu default + kernel vmlinuz + append initrd=initrd.img quiet +menu separator # insert an empty line +# utilities submenu +menu begin ^Troubleshooting + menu title Troubleshooting +label vesa + menu indent count 5 + menu label Install @PRODUCT@ in ^basic graphics mode. + text help + Try this option out if you're having trouble installing + @PRODUCT@. + endtext + kernel vmlinuz + append initrd=initrd.img xdriver=vesa nomodeset quiet +label rescue + menu indent count 5 + menu label ^Rescue a @PRODUCT@ system. + text help + If the system will not boot, this lets you access files + and edit config files to try to get it booting again. + endtext + kernel vmlinuz + append initrd=initrd.img rescue quiet +label memtest + menu label Run a ^memory test. + text help + If your system is having issues, a problem with your + system's memory may be the cause. Use this utility to + see if the memory is working correctly. + endtext + kernel memtest +menu separator # insert an empty line +label local + menu label Boot from ^local drive. + localboot 0xffff +menu separator # insert an empty line +menu separator # insert an empty line +label returntomain + menu label Return to ^main menu. + menu exit +menu end +#label local +# menu label Exit this menu and boot from ^local disk. +# localboot 0xffff + diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 23b6059c..2a33a02b 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -65,7 +65,7 @@ ISOLINUXDIR = "isolinux" PXEBOOTDIR = "images/pxeboot" ISOLINUX_BIN = "usr/share/syslinux/isolinux.bin" -SYSLINUX_CFG = "usr/share/anaconda/boot/syslinux.cfg" +ISOLINUX_CFG = "usr/share/anaconda/boot/isolinux.cfg" ISOHYBRID = "isohybrid" @@ -385,9 +385,9 @@ class X86(object): self.reqs["isolinux_bin"] = cpfile(isolinux_bin, workdir) - # syslinux.cfg - syslinux_cfg = joinpaths(self.installtree.root, SYSLINUX_CFG) - self.reqs["syslinux_cfg"] = cpfile(syslinux_cfg, workdir) + # isolinux.cfg + isolinux_cfg = joinpaths(self.installtree.root, ISOLINUX_CFG) + self.reqs["isolinux_cfg"] = cpfile(isolinux_cfg, workdir) # memtest memtest = glob.glob(joinpaths(self.installtree.root, "boot", @@ -437,10 +437,9 @@ class X86(object): cpfile(self.reqs["isolinux_bin"], joinpaths(self.outputroot, ISOLINUXDIR)) - # copy syslinux.cfg to isolinux dir (XXX rename to isolinux.cfg) - isolinux_cfg = cpfile(self.reqs["syslinux_cfg"], - joinpaths(self.outputroot, ISOLINUXDIR, - "isolinux.cfg")) + # copy isolinux.cfg to isolinux dir + isolinux_cfg = cpfile(self.reqs["isolinux_cfg"], + joinpaths(self.outputroot, ISOLINUXDIR)) replace(isolinux_cfg, r"@PRODUCT@", self.product) replace(isolinux_cfg, r"@VERSION@", self.version) @@ -450,11 +449,11 @@ class X86(object): cpfile(self.reqs["memtest"], joinpaths(self.outputroot, ISOLINUXDIR)) - with open(isolinux_cfg, "a") as f: - f.write("label memtest86\n") - f.write(" menu label ^Memory test\n") - f.write(" kernel memtest\n") - f.write(" append -\n") + #with open(isolinux_cfg, "a") as f: + # f.write("label memtest86\n") + # f.write(" menu label ^Memory test\n") + # f.write(" kernel memtest\n") + # f.write(" append -\n") # copy *.msg files for src in self.reqs["msgfiles"]: @@ -469,10 +468,6 @@ class X86(object): cpfile(self.reqs["vesamenu"], joinpaths(self.outputroot, ISOLINUXDIR)) - # set up isolinux.cfg - replace(isolinux_cfg, r"default linux", "default vesamenu.c32") - replace(isolinux_cfg, r"prompt 1", "#prompt 1") - # copy grub.conf grubconf = cpfile(self.reqs["grubconf"], joinpaths(self.outputroot, ISOLINUXDIR)) diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index e0ddd9a4..7a2bedac 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -431,6 +431,10 @@ class LoraxInstallTree(BaseLoraxClass): dst = joinpaths(self.root, "etc/sysconfig") shutil.copy2(src, dst) + src = joinpaths(src_dir, "isolinux.cfg") + dst = joinpaths(self.root, "usr/share/anaconda/boot") + shutil.copy2(src, dst) + def setup_sshd(self, src_dir): # get sshd config src = joinpaths(src_dir, "sshd_config.anaconda") From 91f7908031af03dd96114e2649b69a12cf3af0d6 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 9 Sep 2011 15:54:29 +0200 Subject: [PATCH 48/60] Do not create the sysconfig/network file (#733425) --- share/config_files/network | 1 - src/pylorax/installtree.py | 5 ----- 2 files changed, 6 deletions(-) delete mode 100644 share/config_files/network diff --git a/share/config_files/network b/share/config_files/network deleted file mode 100644 index 895d994a..00000000 --- a/share/config_files/network +++ /dev/null @@ -1 +0,0 @@ -HOSTNAME=localhost.localdomain diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index 7a2bedac..eaea98b6 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -426,11 +426,6 @@ class LoraxInstallTree(BaseLoraxClass): dst = joinpaths(self.root, "etc/selinux", "config") shutil.copy2(src, dst) - # get sysconfig files - src = joinpaths(src_dir, "network") - dst = joinpaths(self.root, "etc/sysconfig") - shutil.copy2(src, dst) - src = joinpaths(src_dir, "isolinux.cfg") dst = joinpaths(self.root, "usr/share/anaconda/boot") shutil.copy2(src, dst) From 05fc838ce222cff3e85fcee4a601b91fbdbbf402 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 19 Sep 2011 10:35:26 +0200 Subject: [PATCH 49/60] syslinux-vesa-splash changed filename (#739345) --- src/pylorax/images.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index 2a33a02b..f5ec4562 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -410,10 +410,10 @@ class X86(object): # splash splash = joinpaths(self.installtree.root, ANABOOTDIR, - "syslinux-vesa-splash.jpg") + "syslinux-splash.png") if not splash: - raise Exception("syslinux-vesa-splash.jpg not present") + raise Exception("syslinux-splash.png not present") self.reqs["splash"] = cpfile(splash, workdir) @@ -460,9 +460,8 @@ class X86(object): dst = cpfile(src, joinpaths(self.outputroot, ISOLINUXDIR)) replace(dst, r"@VERSION@", self.version) - # copy syslinux-vesa-splash.jpg splash = cpfile(self.reqs["splash"], - joinpaths(self.outputroot, ISOLINUXDIR, "splash.jpg")) + joinpaths(self.outputroot, ISOLINUXDIR, "splash.png")) # copy vesamenu.c32 cpfile(self.reqs["vesamenu"], From 60c444c0c912b3d920fc3334d054b0f0fe8ea04e Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 22 Sep 2011 10:07:11 +0200 Subject: [PATCH 50/60] Use own addrsize implementation (dhorak) Anaconda doesn't built the addrsize tool used to create the file containing size and load address for initrd.img. So we implement its function directly in lorax. --- src/pylorax/images.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index f5ec4562..c30620af 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -27,6 +27,7 @@ import subprocess import shutil import glob import collections +import struct from base import DataHolder from sysutils import joinpaths, cpfile, replace @@ -637,16 +638,13 @@ class S390(object): logger.info("compressing the install tree") self.installtree.compress(initrd, kernel, self.ctype, self.cargs) - # run addrsize - addrsize = joinpaths(self.installtree.root, "usr/libexec", - "anaconda", "addrsize") - - cmd = [addrsize, INITRD_ADDRESS, initrd.fpath, - joinpaths(self.outputroot, IMAGESDIR, "initrd.addrsize")] - - p = subprocess.Popen(cmd, stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - p.wait() + # create initrd.addrsize + addrsize = open(joinpaths(self.outputroot, IMAGESDIR, + "initrd.addrsize"), "wb") + addrsize_data = struct.pack(">iiii", 0, int(INITRD_ADDRESS, 16), 0, + os.stat(initrd.fpath).st_size) + addrsize.write(addrsize_data) + addrsize.close() # add kernel and initrd to .treeinfo kernel_arch = kernel.version.split(".")[-1] From b30b07ca796985c1de28f52e02d43a3f3c823f6c Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Thu, 22 Sep 2011 10:09:12 +0200 Subject: [PATCH 51/60] Don't use mk-s390-cdboot (dhorak) Anaconda dropped the mk-s390-cdboot tool, so we can't call it in lorax. --- src/pylorax/images.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/pylorax/images.py b/src/pylorax/images.py index c30620af..14753916 100644 --- a/src/pylorax/images.py +++ b/src/pylorax/images.py @@ -657,24 +657,6 @@ class S390(object): "generic.ins": os.path.basename(generic_ins)} self.treeinfo.add_section(section, data) - # create cdboot.img - bootiso_fpath = joinpaths(self.outputroot, IMAGESDIR, "cdboot.img") - - # run mks390cdboot - mks390cdboot = joinpaths(self.installtree.root, "usr/libexec", - "anaconda", "mk-s390-cdboot") - - cmd = [mks390cdboot, "-i", kernel.fpath, "-r", initrd.fpath, - "-p", generic_prm, "-o", bootiso_fpath] - - p = subprocess.Popen(cmd, stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - p.wait() - - # add cdboot.img to treeinfo - data = {"cdboot.img": joinpaths(IMAGESDIR, "cdboot.img")} - self.treeinfo.add_section(section, data) - def create_boot(self, efiboot=None): pass From ee436805efd86babeb8e28aa45f32bab097169c9 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 23 Sep 2011 13:02:55 +0200 Subject: [PATCH 52/60] Add xen-kbdfront package to initrd (#740378) --- share/ramdisk.ltmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index bba5506d..033f9d5b 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -160,6 +160,7 @@ install "volume_key" install "volume_key-libs" install "wget" install "wqy-microhei-fonts" +install "xen-kbdfront" install "xfsprogs" install "xorg-x11-drivers" install "xorg-x11-fonts-ethiopic" From af6d4e2c50072eb3d76242481cb6c1bc016f6f54 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 3 Oct 2011 11:53:39 -0700 Subject: [PATCH 53/60] copy kickstarts into sysroot (#743135) The installer no longer has access to the initrd's root. We need to copy any needed files over to /sysroot before switching root. This copies *.cfg and *.ks files. It also adds the ability to add dracut hook scripts to the initramfs from /usr/share/lorax/dracut_hooks/ --- share/dracut_hooks/99anaconda-copy-ks.sh | 4 +++ src/pylorax/__init__.py | 3 +- src/pylorax/installtree.py | 46 ++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100755 share/dracut_hooks/99anaconda-copy-ks.sh diff --git a/share/dracut_hooks/99anaconda-copy-ks.sh b/share/dracut_hooks/99anaconda-copy-ks.sh new file mode 100755 index 00000000..ed52088a --- /dev/null +++ b/share/dracut_hooks/99anaconda-copy-ks.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Copy over kickstart files from the initrd to the sysroot before pivot +cp /*cfg /*ks /sysroot/ 2> /dev/null + diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 8eb6c7fa..ff14b4f3 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -203,7 +203,8 @@ class Lorax(BaseLoraxClass): # set up install tree logger.info("setting up install tree") self.installtree = LoraxInstallTree(self.yum, self.basearch, - self.libdir, self.workdir) + self.libdir, self.workdir, + self.conf) # set up required build parameters logger.info("setting up build parameters") diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index eaea98b6..5b92ab56 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -39,7 +39,7 @@ from sysutils import * class LoraxInstallTree(BaseLoraxClass): - def __init__(self, yum, basearch, libdir, workdir): + def __init__(self, yum, basearch, libdir, workdir, conf=None): BaseLoraxClass.__init__(self) self.yum = yum self.root = self.yum.installroot @@ -47,9 +47,45 @@ class LoraxInstallTree(BaseLoraxClass): self.libdir = libdir self.workdir = workdir self.initramfs = {} + self.conf = conf self.lcmds = constants.LoraxRequiredCommands() + @property + def dracut_hooks_path(self): + """ Return the path to the lorax dracut hooks scripts + + Use the configured share dir if it is setup, + otherwise default to /usr/share/lorax/dracut_hooks + """ + if self.conf: + return joinpaths(self.conf.get("lorax", "sharedir"), + "dracut_hooks") + else: + return "/usr/share/lorax/dracut_hooks" + + def copy_dracut_hooks(self, hooks): + """ Copy the hook scripts in hooks into the installroot's /tmp/ + and return a list of commands to pass to dracut when creating the + initramfs + + hooks is a list of tuples with the name of the hook script and the + target dracut hook directory + (eg. [("99anaconda-copy-ks.sh", "/lib/dracut/hooks/pre-pivot")]) + """ + dracut_commands = [] + for hook_script, dracut_path in hooks: + src = joinpaths(self.dracut_hooks_path, hook_script) + if not os.path.exists(src): + logger.error("Missing lorax dracut hook script %s" % (src)) + continue + dst = joinpaths(self.root, "/tmp/", hook_script) + shutil.copy2(src, dst) + dracut_commands += ["--include", joinpaths("/tmp/", hook_script), + dracut_path] + + return dracut_commands + def remove_locales(self): chroot = lambda: os.chroot(self.root) @@ -548,12 +584,16 @@ class LoraxInstallTree(BaseLoraxClass): def make_dracut_initramfs(self): for kernel in self.kernels: + hooks = [("99anaconda-copy-ks.sh", "/lib/dracut/hooks/pre-pivot")] + hook_commands = self.copy_dracut_hooks(hooks) + outfile = "/tmp/initramfs.img" # inside the chroot logger.debug("chrooting into installtree to create initramfs.img") subprocess.check_call(["chroot", self.root, "/sbin/dracut", "--noprefix", "--nomdadmconf", "--nolvmconf", - "--xz", "--modules", "base dmsquash-live", - outfile, kernel.version]) + "--xz", "--modules", "base dmsquash-live"] \ + + hook_commands \ + + [outfile, kernel.version]) # move output file into installtree workdir dstdir = joinpaths(self.workdir, "dracut-%s" % kernel.version) os.makedirs(dstdir) From 049d73874c460529928e67cd9fa6ac9e87fbfb53 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 3 Oct 2011 12:17:17 +0200 Subject: [PATCH 54/60] Check if /proc is mounted (#741722) Needed for proper functionality in chroot, so if it is not there, exit before doing anything. --- src/pylorax/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index ff14b4f3..6f73f397 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -170,6 +170,13 @@ class Lorax(BaseLoraxClass): logger.critical("no root privileges") sys.exit(1) + # check if /proc is mounted + logger.info("checking /proc") + if (not os.path.isdir("/proc") and not os.path.exists("/proc/mounts") + and not os.path.exists("/proc/devices")): + logger.critical("missing required /proc files (not mounted?)") + sys.exit(1) + # do we have all lorax required commands? self.lcmds = constants.LoraxRequiredCommands() From 30f48041fc5a3a2c2aac5f0a67155f7d060a8951 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 3 Oct 2011 12:18:41 +0200 Subject: [PATCH 55/60] Ignore remove errors On some nfs mounts the shutil.rmtree may traceback when removing some files. This is not such a problem so we can ignore these errors and continue. --- src/pylorax/yumhelper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pylorax/yumhelper.py b/src/pylorax/yumhelper.py index 04ad1402..904fdc29 100644 --- a/src/pylorax/yumhelper.py +++ b/src/pylorax/yumhelper.py @@ -117,7 +117,7 @@ class LoraxYumHelper(object): if os.path.islink(fname) or os.path.isfile(fname): os.unlink(fname) else: - shutil.rmtree(fname) + shutil.rmtree(fname, ignore_errors=True) logger.debug("removed {0}".format(fname)) count += 1 From 7ec467b2d29f379e65bcf017fc964220fefd079a Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 11 Oct 2011 14:12:50 +0200 Subject: [PATCH 56/60] xen-kbdfront is a module not a package (#740378) --- share/ramdisk.ltmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 033f9d5b..ca54a8b7 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -160,7 +160,6 @@ install "volume_key" install "volume_key-libs" install "wget" install "wqy-microhei-fonts" -install "xen-kbdfront" install "xfsprogs" install "xorg-x11-drivers" install "xorg-x11-fonts-ethiopic" @@ -438,6 +437,7 @@ module "usb-storage" module "usbhid" module "vfat" module "virtio_pci" +module "xen-kbdfront" module "xfs" module "xts" module "yenta_socket" From e61f3b23d47903b30ac0ce591a200dc5edc4f979 Mon Sep 17 00:00:00 2001 From: Ales Kozumplik Date: Tue, 11 Oct 2011 15:54:12 +0200 Subject: [PATCH 57/60] rsyslgod config: hardcode the hostname for virtio forwarding. The value systemd provides at this early point when rsyslogd starts is "(none)". This makes the receiving syslog unable to parse the incoming messages. Resolves: rhbz#744544 --- share/config_files/rsyslog.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/config_files/rsyslog.conf b/share/config_files/rsyslog.conf index 64728b88..e568e536 100644 --- a/share/config_files/rsyslog.conf +++ b/share/config_files/rsyslog.conf @@ -23,7 +23,7 @@ $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat $template anaconda_tty4, "%syslogseverity-text:::uppercase% %programname%:%msg%\n" $template anaconda_syslog, "%timestamp:8:$:date-rfc3164%,%timestamp:1:3:date-subseconds% %syslogseverity-text:::uppercase% %programname%:%msg%\n" -$template virtio_ForwardFormat, "<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%\n" +$template virtio_ForwardFormat, "<%PRI%>%TIMESTAMP:::date-rfc3339% localhost %syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%\n" #### RULES #### # log everything except anaconda-specific records from local1 (those are stored From 2ce5fe7b3deba1947ade59dac7752f513b1278e5 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 17 Oct 2011 14:00:49 +0200 Subject: [PATCH 58/60] Add fpaste to install environment (#727842) --- share/ramdisk.ltmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index ca54a8b7..69bebf12 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -70,6 +70,7 @@ install "fedora-gnome-theme" install "fedora-icon-theme" install "firstaidkit-engine" install "firstboot" +install "fpaste" install "ftp" install "gdb-gdbserver" install "gdk-pixbuf" From 00de3d6266996f1bea9ac8e93ceb4b23c171f2fb Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Mon, 17 Oct 2011 19:11:51 +0200 Subject: [PATCH 59/60] Changes required for grub2 (dgilmore) --- share/ramdisk.ltmpl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 69bebf12..52cced05 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -18,8 +18,8 @@ install "kernel" % if basearch == "i386" or basearch == "x86_64": install "biosdevname" install "efibootmgr" - install "firstaidkit-plugin-grub" - install "grub" + install "grub2" + install "grub-efi" install "memtest86+" % endif @@ -794,8 +794,6 @@ remove "groff" "/usr/bin/tfmtodit" remove "groff" "/usr/bin/troff" remove "groff" "/usr/bin/zsoelim" remove "groff" "/usr/share/*" -remove "grub" "/sbin/grub-*" -remove "grub" "/usr/bin/*" remove "gstreamer" "/usr/bin/*" remove "gstreamer" "/usr/${libdir}/gstreamer-0.10/*" remove "gstreamer" "/usr/${libdir}/libgst*" From 7f4b7fa00f2f77650a1bd04fadad5752b5ba8495 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 18 Oct 2011 12:18:59 +0200 Subject: [PATCH 60/60] Do not remove /usr/bin/env --- share/ramdisk.ltmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/share/ramdisk.ltmpl b/share/ramdisk.ltmpl index 52cced05..376cc121 100644 --- a/share/ramdisk.ltmpl +++ b/share/ramdisk.ltmpl @@ -578,7 +578,6 @@ remove "coreutils" "/usr/bin/cut" remove "coreutils" "/usr/bin/dir" remove "coreutils" "/usr/bin/dircolors" remove "coreutils" "/usr/bin/dirname" -remove "coreutils" "/usr/bin/env" remove "coreutils" "/usr/bin/expand" remove "coreutils" "/usr/bin/factor" remove "coreutils" "/usr/bin/fmt"