From 79ad8c0a1a2f110d432c71ba8fa54ef911b2767c Mon Sep 17 00:00:00 2001 From: Rahul Sundaram Date: Jan 28 2008 22:55:54 +0000 Subject: initial commit for EPEL --- diff --git a/.cvsignore b/.cvsignore index ba3fc7c..4c0bee8 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,3 @@ -livecd-tools-008.tar.bz2 +livecd-tools-013.tar.bz2 +imgcreate-try-finally.patch +imgcreate-old-pykickstart.patch diff --git a/imgcreate-old-pykickstart.patch b/imgcreate-old-pykickstart.patch new file mode 100644 index 0000000..5a126c0 --- /dev/null +++ b/imgcreate-old-pykickstart.patch @@ -0,0 +1,406 @@ +Backport imgcreate to RHEL5 pykickstart + +RHEL5 pykickstart differs from latest Fedora pykickstart +in quite a number of ways: + + - No commands, errors or version sub-modules, but there + is a data sub-module + + - readKickstart() doesn't support relative includes + very well; it only tries the paths relative to the + current directory rather than relative to the directory + the topmost kickstart is in + + - Most of the parsed data is available at KsParser.ksdata + rather than KsParser.hander.foo + + - No support for group include types (i.e. required, default, + all etc.) + + - The contents of ksdata.groupList are a simply groups names + rather than Group objects + + - ksdata.device has the following format: + + [:...] [--opts=] + + rather than being a Device object. + + - No bootloader timeout or default kernel options. + + - No includepkgs/excludepkgs repo options. + + - Some ksdata attributes - e.g. timezone, firewall, rootpw, + etc. - are dicts rather than objects + +Signed-off-by: Mark McLoughlin + +Index: livecd/imgcreate/creator.py +=================================================================== +--- livecd.orig/imgcreate/creator.py ++++ livecd/imgcreate/creator.py +@@ -507,16 +507,16 @@ class ImageCreator(object): + skipped_groups = [] + for group in kickstart.get_groups(self.ks): + try: +- ayum.selectGroup(group.name, group.include) ++ ayum.selectGroup(group) + except (yum.Errors.InstallError, yum.Errors.GroupsError), e: + if kickstart.ignore_missing(self.ks): + raise CreatorError("Failed to find group '%s' : %s" % +- (group.name, e)) ++ (group, e)) + else: + skipped_groups.append(group) + + for group in skipped_groups: +- print >> sys.stderr, "Skipping missing group '%s'" % (group.name,) ++ print >> sys.stderr, "Skipping missing group '%s'" % (group,) + + def __deselect_packages(self, ayum): + for pkg in kickstart.get_excluded(self.ks, +@@ -540,14 +540,8 @@ class ImageCreator(object): + ayum = LiveCDYum() + ayum.setup(yum_conf, self._instroot) + +- for repo in kickstart.get_repos(self.ks, repo_urls): +- (name, baseurl, mirrorlist, inc, exc) = repo +- ++ for (name, baseurl, mirrorlist) in kickstart.get_repos(self.ks, repo_urls): + yr = ayum.addRepository(name, baseurl, mirrorlist) +- if inc: +- yr.includepkgs = inc +- if exc: +- yr.exclude = exc + + if kickstart.exclude_docs(self.ks): + rpm.addMacro("_excludedocs", "1") +@@ -615,19 +609,19 @@ class ImageCreator(object): + creating an initrd and bootloader configuration. + + """ +- ksh = self.ks.handler ++ ksd = self.ks.ksdata + +- kickstart.LanguageConfig(self._instroot).apply(ksh.lang) +- kickstart.KeyboardConfig(self._instroot).apply(ksh.keyboard) +- kickstart.TimezoneConfig(self._instroot).apply(ksh.timezone) +- kickstart.AuthConfig(self._instroot).apply(ksh.authconfig) +- kickstart.FirewallConfig(self._instroot).apply(ksh.firewall) +- kickstart.SelinuxConfig(self._instroot).apply(ksh.selinux) +- kickstart.RootPasswordConfig(self._instroot).apply(ksh.rootpw) +- kickstart.ServicesConfig(self._instroot).apply(ksh.services) +- kickstart.XConfig(self._instroot).apply(ksh.xconfig) +- kickstart.NetworkConfig(self._instroot).apply(ksh.network) +- kickstart.SelinuxConfig(self._instroot).apply(ksh.selinux) ++ kickstart.LanguageConfig(self._instroot).apply(ksd.lang) ++ kickstart.KeyboardConfig(self._instroot).apply(ksd.keyboard) ++ kickstart.TimezoneConfig(self._instroot).apply(ksd.timezone) ++ kickstart.AuthConfig(self._instroot).apply(ksd.authconfig) ++ kickstart.FirewallConfig(self._instroot).apply(ksd.firewall) ++ kickstart.SelinuxConfig(self._instroot).apply(ksd.selinux) ++ kickstart.RootPasswordConfig(self._instroot).apply(ksd.rootpw) ++ kickstart.ServicesConfig(self._instroot).apply(ksd.services) ++ kickstart.XConfig(self._instroot).apply(ksd.xconfig) ++ kickstart.NetworkConfig(self._instroot).apply(ksd.network) ++ kickstart.SelinuxConfig(self._instroot).apply(ksd.selinux) + + self._create_bootconfig() + +Index: livecd/imgcreate/kickstart.py +=================================================================== +--- livecd.orig/imgcreate/kickstart.py ++++ livecd/imgcreate/kickstart.py +@@ -21,11 +21,9 @@ import os.path + import subprocess + import time + +-import pykickstart.commands as kscommands + import pykickstart.constants as ksconstants +-import pykickstart.errors as kserrors ++import pykickstart.data as ksdata + import pykickstart.parser as ksparser +-import pykickstart.version as ksversion + + import imgcreate.errors as errors + import imgcreate.fs as fs +@@ -40,16 +38,29 @@ def read_kickstart(path): + If an error occurs, a CreatorError exception is thrown. + + """ +- version = ksversion.makeVersion() +- ks = ksparser.KickstartParser(version) ++ data = ksdata.KickstartData() ++ ks = ksparser.KickstartParser(data, ksparser.KickstartHandlers(data)) ++ ++ # ++ # We change dirs to the dirname of the kickstart file so ++ # that %include can use relative paths. This is fixed in ++ # pykickstart itself in later versions ++ # ++ cwd = os.getcwd() ++ (dirname, basename) = os.path.split(os.path.abspath(path)) ++ os.chdir(dirname) + try: +- ks.readKickstart(path) +- except IOError, (err, msg): +- raise errors.KickstartError("Failed to read kickstart file " +- "'%s' : %s" % (path, msg)) +- except kserrors.KickstartError, e: +- raise errors.KickstartError("Failed to parse kickstart file " +- "'%s' : %s" % (path, e)) ++ try: ++ ks.readKickstart(basename) ++ except IOError, (err, msg): ++ raise errors.KickstartError("Failed to read kickstart file " ++ "'%s' : %s" % (path, msg)) ++ except ksparser.KickstartError, e: ++ raise errors.KickstartError("Failed to parse kickstart file " ++ "'%s' : %s" % (path, e)) ++ finally: ++ os.chdir(cwd) ++ + return ks + + def build_name(kscfg, prefix = None, suffix = None, maxlen = None): +@@ -115,7 +126,7 @@ class KickstartConfig(object): + class LanguageConfig(KickstartConfig): + """A class to apply a kickstart language configuration to a system.""" + def apply(self, kslang): +- lang = kslang.lang or "en_US.UTF-8" ++ lang = kslang or "en_US.UTF-8" + + f = open(self.path("/etc/sysconfig/i18n"), "w+") + f.write("LANG=\"" + lang + "\"\n") +@@ -131,15 +142,15 @@ class KeyboardConfig(KickstartConfig): + # + import rhpl.keyboard + k = rhpl.keyboard.Keyboard() +- if kskeyboard.keyboard: +- k.set(kskeyboard.keyboard) ++ if kskeyboard: ++ k.set(kskeyboard) + k.write(self.instroot) + + class TimezoneConfig(KickstartConfig): + """A class to apply a kickstart timezone configuration to a system.""" + def apply(self, kstimezone): +- tz = kstimezone.timezone or "America/New_York" +- utc = str(kstimezone.isUtc) ++ tz = kstimezone["timezone"] or "America/New_York" ++ utc = str(kstimezone["isUtc"]) + + f = open(self.path("/etc/sysconfig/clock"), "w+") + f.write("ZONE=\"" + tz + "\"\n") +@@ -152,7 +163,7 @@ class AuthConfig(KickstartConfig): + if not os.path.exists(self.path("/usr/sbin/authconfig")): + return + +- auth = ksauthconfig.authconfig or "--useshadow --enablemd5" ++ auth = ksauthconfig or "--useshadow --enablemd5" + args = ["/usr/sbin/authconfig", "--update", "--nostart"] + self.call(args + auth.split()) + +@@ -162,7 +173,7 @@ class FirewallConfig(KickstartConfig): + # + # FIXME: should handle the rest of the options + # +- if not ksfirewall.enabled: ++ if not ksfirewall["enabled"]: + return + if not os.path.exists(self.path("/usr/sbin/lokkit")): + return +@@ -188,10 +199,10 @@ class RootPasswordConfig(KickstartConfig + p2.communicate() + + def apply(self, ksrootpw): +- if ksrootpw.isCrypted: +- self.set_encrypted(ksrootpw.password) +- elif ksrootpw.password != "": +- self.set_unencrypted(ksrootpw.password) ++ if ksrootpw["isCrypted"]: ++ self.set_encrypted(ksrootpw["password"]) ++ elif ksrootpw["password"] != "": ++ self.set_unencrypted(ksrootpw["password"]) + else: + self.unset() + +@@ -200,15 +211,15 @@ class ServicesConfig(KickstartConfig): + def apply(self, ksservices): + if not os.path.exists(self.path("/sbin/chkconfig")): + return +- for s in ksservices.enabled: ++ for s in ksservices["enabled"]: + self.call(["/sbin/chkconfig", s, "on"]) +- for s in ksservices.disabled: ++ for s in ksservices["disabled"]: + self.call(["/sbin/chkconfig", s, "off"]) + + class XConfig(KickstartConfig): + """A class to apply a kickstart X configuration to a system.""" + def apply(self, ksxconfig): +- if not ksxconfig.startX: ++ if not ksxconfig["startX"]: + return + f = open(self.path("/etc/inittab"), "rw+") + buf = f.read() +@@ -329,7 +340,7 @@ class NetworkConfig(KickstartConfig): + gateway = None + nameservers = None + +- for network in ksnet.network: ++ for network in ksnet: + if not network.device: + raise errros.KickstartError("No --device specified with " + "network kickstart command") +@@ -370,7 +381,7 @@ class SelinuxConfig(KickstartConfig): + f = file(path, "w+") + os.chmod(path, 0644) + +- if not ksselinux.selinux: ++ if not ksselinux: + return + if not os.path.exists(self.path("/sbin/restorecon")): + return +@@ -381,7 +392,7 @@ class SelinuxConfig(KickstartConfig): + if os.path.exists(self.path("/usr/sbin/lokkit")): + args = ["/usr/sbin/lokkit", "-f", "--quiet", "--nostart"] + +- if ksselinux.selinux: ++ if ksselinux: + args.append("--selinux=enforcing") + else: + args.append("--selinux=disabled") +@@ -391,51 +402,35 @@ class SelinuxConfig(KickstartConfig): + self.relabel(ksselinux) + + def get_image_size(ks, default = None): +- for p in ks.handler.partition.partitions: ++ for p in ks.ksdata.partitions: + if p.mountpoint == "/" and p.size: + return int(p.size) * 1024L * 1024L + return default + + def get_modules(ks): +- devices = [] +- if isinstance(ks.handler.device, kscommands.device.FC3_Device): +- devices.append(ks.handler.device) +- else: +- devices.extend(ks.handler.device.deviceList) +- + modules = [] +- for device in devices: +- if not device.moduleName: +- continue +- modules.extend(device.moduleName.split(":")) ++ try: ++ # ++ # Format with RHEL5 pykickstart appears to be: ++ # [:...] [--opts=] ++ # ++ modules.extend(ks.ksdata.device.split()[1].split(":")) ++ except: ++ pass + + return modules + + def get_timeout(ks, default = None): +- if not hasattr(ks.handler.bootloader, "timeout"): +- return default +- if ks.handler.bootloader.timeout is None: +- return default +- return int(ks.handler.bootloader.timeout) ++ # No equivalent with RHEL5 pykickstart ++ return default + + def get_default_kernel(ks, default = None): +- if not hasattr(ks.handler.bootloader, "default"): +- return default +- if not ks.handler.bootloader.default: +- return default +- return ks.handler.bootloader.default ++ # No equivalent with RHEL5 pykickstart ++ return default + + def get_repos(ks, repo_urls = {}): + repos = [] +- for repo in ks.handler.repo.repoList: +- inc = [] +- if hasattr(repo, "includepkgs"): +- inc.extend(repo.includepkgs) +- +- exc = [] +- if hasattr(repo, "excludepkgs"): +- exc.extend(repo.excludepkgs) +- ++ for repo in ks.ksdata.repoList: + baseurl = repo.baseurl + mirrorlist = repo.mirrorlist + +@@ -443,38 +438,36 @@ def get_repos(ks, repo_urls = {}): + baseurl = repo_urls[repo.name] + mirrorlist = None + +- repos.append((repo.name, baseurl, mirrorlist, inc, exc)) ++ repos.append((repo.name, baseurl, mirrorlist)) + + return repos + + def convert_method_to_repo(ks): +- try: +- ks.handler.repo.methodToRepo() +- except (AttributeError, kserrors.KickstartError): +- pass ++ # No equivalent with RHEL5 pykickstart ++ pass + + def get_packages(ks, required = []): +- return ks.handler.packages.packageList + required ++ return ks.ksdata.packageList + required + + def get_groups(ks, required = []): +- return ks.handler.packages.groupList + required ++ return ks.ksdata.groupList + required + + def get_excluded(ks, required = []): +- return ks.handler.packages.excludedList + required ++ return ks.ksdata.excludedList + required + + def ignore_missing(ks): +- return ks.handler.packages.handleMissing == ksconstants.KS_MISSING_IGNORE ++ return ks.ksdata.handleMissing == ksconstants.KS_MISSING_IGNORE + + def exclude_docs(ks): +- return ks.handler.packages.excludeDocs ++ return ks.ksdata.excludeDocs + + def get_post_scripts(ks): + scripts = [] +- for s in ks.handler.scripts: ++ for s in ks.ksdata.scripts: + if s.type != ksparser.KS_SCRIPT_POST: + continue + scripts.append(s) + return scripts + + def selinux_enabled(ks): +- return ks.handler.selinux.selinux ++ return ks.ksdata.selinux +Index: livecd/imgcreate/yuminst.py +=================================================================== +--- livecd.orig/imgcreate/yuminst.py ++++ livecd/imgcreate/yuminst.py +@@ -104,12 +104,8 @@ class LiveCDYum(yum.YumBase): + else: + print >> sys.stderr, "No such package %s to remove" %(pkg,) + +- def selectGroup(self, grp, include = pykickstart.parser.GROUP_DEFAULT): ++ def selectGroup(self, grp): + yum.YumBase.selectGroup(self, grp) +- if include == pykickstart.parser.GROUP_REQUIRED: +- map(lambda p: self.deselectPackage(p), grp.default_packages.keys()) +- elif include == pykickstart.parser.GROUP_ALL: +- map(lambda p: self.selectPackage(p), grp.optional_packages.keys()) + + def addRepository(self, name, url = None, mirrorlist = None): + def _varSubstitute(option): diff --git a/imgcreate-try-finally.patch b/imgcreate-try-finally.patch new file mode 100644 index 0000000..45949b7 --- /dev/null +++ b/imgcreate-try-finally.patch @@ -0,0 +1,125 @@ +Don't use try/except/finally - not supported before python 2.5 + +The construct: + + try: + do_something() + except: + handle_exception() + finally: + do_cleanup() + +is not supported with RHEL 5.1 python, so we change to: + + try: + try: + do_something() + except: + handle_exception() + finally: + do_cleanup() + +Signed-off-by: Mark McLoughlin + +Index: livecd/imgcreate/creator.py +=================================================================== +--- livecd.orig/imgcreate/creator.py 2008-01-08 09:42:55.000000000 +0000 ++++ livecd/imgcreate/creator.py 2008-01-08 09:50:31.000000000 +0000 +@@ -553,14 +553,15 @@ + rpm.addMacro("_excludedocs", "1") + + try: +- self.__select_packages(ayum) +- self.__select_groups(ayum) +- self.__deselect_packages(ayum) +- ayum.runInstall() +- except yum.Errors.RepoError, e: +- raise CreatorError("Unable to download from repo : %s" % (e,)) +- except yum.Errors.YumBaseError, e: +- raise CreatorError("Unable to install: %s" % (e,)) ++ try: ++ self.__select_packages(ayum) ++ self.__select_groups(ayum) ++ self.__deselect_packages(ayum) ++ ayum.runInstall() ++ except yum.Errors.RepoError, e: ++ raise CreatorError("Unable to download from repo : %s" % (e,)) ++ except yum.Errors.YumBaseError, e: ++ raise CreatorError("Unable to install: %s" % (e,)) + finally: + ayum.closeRpmDB() + ayum.close() +@@ -595,11 +596,12 @@ + script = "/tmp/" + os.path.basename(path) + + try: +- subprocess.call([s.interp, script], +- preexec_fn = preexec, env = env) +- except OSError, (err, msg): +- raise CreatorError("Failed to execute %%post script " +- "with '%s' : %s" % (s.interp, msg)) ++ try: ++ subprocess.call([s.interp, script], ++ preexec_fn = preexec, env = env) ++ except OSError, (err, msg): ++ raise CreatorError("Failed to execute %%post script " ++ "with '%s' : %s" % (s.interp, msg)) + finally: + os.unlink(path) + +Index: livecd/tools/image-creator +=================================================================== +--- livecd.orig/tools/image-creator 2007-12-11 11:22:17.000000000 +0000 ++++ livecd/tools/image-creator 2008-01-08 09:51:01.000000000 +0000 +@@ -59,10 +59,11 @@ + creator = imgcreate.LoopImageCreator(ks, name) + + try: +- creator.create() +- except imgcreate.CreatorError, e: +- print >> sys.stderr, "Error creating image : %s" % e +- return 1 ++ try: ++ creator.create() ++ except imgcreate.CreatorError, e: ++ print >> sys.stderr, "Error creating image : %s" % e ++ return 1 + finally: + creator.cleanup() + +Index: livecd/tools/livecd-creator +=================================================================== +--- livecd.orig/tools/livecd-creator 2007-12-11 11:22:17.000000000 +0000 ++++ livecd/tools/livecd-creator 2008-01-08 09:51:35.000000000 +0000 +@@ -111,18 +111,19 @@ + creator.skip_minimize = options.skip_minimize + + try: +- creator.mount(options.base_on, options.cachedir) +- creator.install() +- creator.configure() +- if options.give_shell: +- print "Launching shell. Exit to continue." +- print "----------------------------------" +- creator.launch_shell() +- creator.unmount() +- creator.package() +- except imgcreate.CreatorError, e: +- print >> sys.stderr, "Error creating Live CD : %s" % e +- return 1 ++ try: ++ creator.mount(options.base_on, options.cachedir) ++ creator.install() ++ creator.configure() ++ if options.give_shell: ++ print "Launching shell. Exit to continue." ++ print "----------------------------------" ++ creator.launch_shell() ++ creator.unmount() ++ creator.package() ++ except imgcreate.CreatorError, e: ++ print >> sys.stderr, "Error creating Live CD : %s" % e ++ return 1 + finally: + creator.cleanup() + diff --git a/livecd-tools.spec b/livecd-tools.spec index b8c7a4e..4af9de1 100644 --- a/livecd-tools.spec +++ b/livecd-tools.spec @@ -1,11 +1,16 @@ +%define debug_package %{nil} + Summary: Tools for building live CD's Name: livecd-tools -Version: 008 -Release: 1%{?dist} -License: GPL +Version: 013 +Release: 2%{?dist} +License: GPLv2+ Group: System Environment/Base URL: http://git.fedoraproject.org/?p=hosted/livecd Source0: %{name}-%{version}.tar.bz2 +#Source0: livecd.tar.bz2 +Patch0: imgcreate-old-pykickstart.patch +Patch1: imgcreate-try-finally.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Requires: util-linux Requires: coreutils @@ -14,10 +19,17 @@ Requires: yum >= 3.0.0 Requires: mkisofs Requires: squashfs-tools Requires: pykickstart +#Requires: dosfstools >= 2.11-8 +Requires: dosfstools +#Requires: isomd5sum +Requires: anaconda-runtime +%ifarch %{ix86} x86_64 Requires: syslinux -Requires: dosfstools >= 2.11-8 -BuildArch: noarch -ExcludeArch: ppc ppc64 +%endif +%ifarch ppc ppc64 +Requires: yaboot +%endif + %description Tools for generating live CD's on Fedora based systems including @@ -26,6 +38,8 @@ http://fedoraproject.org/wiki/FedoraLiveCD for more details. %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build make @@ -42,55 +56,24 @@ rm -rf $RPM_BUILD_ROOT %doc AUTHORS COPYING README HACKING %{_bindir}/livecd-creator %{_bindir}/livecd-iso-to-disk -%dir /usr/lib/livecd-creator -/usr/lib/livecd-creator/mayflower +%{_bindir}/image-creator +%dir %{_libdir}/livecd-creator +%{_libdir}/livecd-creator/mayflower %dir %{_datadir}/livecd-tools %{_datadir}/livecd-tools/* +%{_libdir}/python?.?/site-packages/imgcreate/* %changelog -* Fri May 4 2007 Jeremy Katz - 008-1 -- disable screensaver with default config -- add aic7xxx and sym53c8xx drivers to default initramfs -- fixes from johnp for FC6 support in the creator -- fix iso-to-stick to work on FC6 - -* Tue Apr 24 2007 Jeremy Katz - 007-1 -- Disable prelinking by default -- Disable some things that slow down the live boot substantially -- Lots of tweaks to the default package manifests -- Allow setting the root password (Jeroen van Meeuwen) -- Allow more specific network line setting (Mark McLoughlin) -- Don't pollute the host yum cache (Mark McLoughlin) -- Add support for mediachecking - -* Wed Apr 4 2007 Jeremy Katz - 006-1 -- Many fixes to error handling from Mark McLoughlin -- Add the KDE config -- Add support for prelinking -- Fixes for installing when running from RAM or usb stick -- Add sanity checking to better ensure that USB stick is bootable - -* Thu Mar 29 2007 Jeremy Katz - 005-3 -- have to use excludearch, not exclusivearch - -* Thu Mar 29 2007 Jeremy Katz - 005-2 -- exclusivearch since it only works on x86 and x86_64 for now - -* Wed Mar 28 2007 Jeremy Katz - 005-1 -- some shell quoting fixes -- allow using UUID or LABEL for the fs label of a usb stick -- work with ext2 formated usb stick - -* Mon Mar 26 2007 Jeremy Katz - 004-1 -- add livecd-iso-to-disk for setting up the live CD iso image onto a usb - stick or similar -* Fri Mar 23 2007 Jeremy Katz - 003-1 -- fix remaining reference to run-init +* Mon Jan 28 2008 Rahul Sundaram - 013-2 +- Initial build for EPEL -* Thu Mar 22 2007 Jeremy Katz - 002-1 -- update for new version +* Mon Oct 29 2007 Jeremy Katz - 013-1 +- Lots of config updates +- Support 'device foo' to say what modules go in the initramfs +- Support multiple kernels being installed +- Allow blacklisting kernel modules on boot with blacklist=foo +- Improve bootloader configs +- Split configs off for f8 -* Fri Dec 22 2006 David Zeuthen - 001-1%{?dist} -- Initial build. diff --git a/sources b/sources index cd9287a..37d1b60 100644 --- a/sources +++ b/sources @@ -1 +1,3 @@ -13d24d79bfe46bea81ec7880cded9deb livecd-tools-008.tar.bz2 +55bb7b79917de9136b2e0b29966b5589 livecd-tools-013.tar.bz2 +09b18795b56fa0a0a038e7267211c9e1 imgcreate-try-finally.patch +53251902c354f369e37b58eaf67dc618 imgcreate-old-pykickstart.patch