Should the user do this, a message gets logged so we will know what's going on when we get bug reports with stuff that ought to be installed missing.
Related: rhbz#1123481 --- kickstart.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kickstart.py b/kickstart.py index 51c5bc7..dda681c 100644 --- a/kickstart.py +++ b/kickstart.py @@ -1585,7 +1585,10 @@ def selectPackages(anaconda): elif rc == 1: ignoreAll = True
- ksdata.packages.groupList.insert(0, Group("Core")) + if ksdata.packages.nocore: + log.warning("skipping core group due to %%packages --nocore; system may not be complete") + else: + ksdata.packages.groupList.insert(0, Group("Core"))
if ksdata.packages.addBase: # Only add @base if it's not already in the group list. If the
Related: rhbz#1123481 --- yuminstall.py | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/yuminstall.py b/yuminstall.py index f20ebbd..7ac68b7 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1910,6 +1910,10 @@ debuglevel=6 if anaconda.isKickstart and anaconda.id.ksdata.packages.excludeDocs: rpm.addMacro("_excludedocs", "1")
+ if anaconda.isKickstart and anaconda.id.ksdata.packages.instLangs is not None: + # Use nil if instLangs is empty + rpm.addMacro('_install_langs', anaconda.id.ksdata.packages.instLangs or '%{nil}') + cb = AnacondaCallback(self.ayum, anaconda, self.instLog, self.modeText) cb.setSizes(len(self.dlpkgs), self.totalSize, self.totalFiles)
This patch (along with one in pykickstart) allows for a kickstart file to do the following:
(1) Prevent any kernel package from being installed by putting "-kernel" in the %packages section.
(2) Prevent any bootloader package from being installed (and therefore, any bootloader config from being written) by putting "bootloader --disabled" in the command section.
Related: rhbz#1123481 --- kickstart.py | 2 +- platform.py | 3 +++ yuminstall.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/kickstart.py b/kickstart.py index dda681c..13e8798 100644 --- a/kickstart.py +++ b/kickstart.py @@ -289,7 +289,7 @@ class Bootloader(commands.bootloader.RHEL6_Bootloader): anaconda.id.bootloader.kickstart = 1 anaconda.id.bootloader.doUpgradeOnly = 1
- if location is None: + if location is None or self.disabled: anaconda.id.ksdata.permanentSkipSteps.extend(["bootloadersetup", "instbootloader"]) else: anaconda.id.ksdata.showSteps.append("bootloader") diff --git a/platform.py b/platform.py index 8338f44..51e2e3f 100644 --- a/platform.py +++ b/platform.py @@ -189,6 +189,9 @@ class Platform(object):
@property def packages (self): + if self.anaconda.isKickstart and self.anaconda.id.ksdata.bootloader.disabled: + return [] + if flags.cmdline.get('fips', None) == '1': return self._packages + ['dracut-fips'] return self._packages diff --git a/yuminstall.py b/yuminstall.py index 7ac68b7..99cc78e 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1574,6 +1574,9 @@ debuglevel=6
return True
+ if anaconda.isKickstart and "kernel" in anaconda.id.ksdata.packages.excludedList: + return + foundkernel = False
if not foundkernel and isys.isPaeAvailable():
The first and last if they don't exist will only log an error message, not cause anaconda to terminate. chkconfig is a little tougher to skip, but still doable. This should really only affect people doing kickstart installs with the --nocore option.
Resolves: rhbz#1123481 --- yuminstall.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/yuminstall.py b/yuminstall.py index 99cc78e..2d72a6a 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -1594,13 +1594,12 @@ debuglevel=6 fspkgs.add(pkg) map(self.selectPackage, fspkgs)
- # anaconda requires several programs on the installed system to complete - # installation, but we have no guarantees that some of these will be - # installed (they could have been removed in kickstart). So we'll force - # it. - def selectAnacondaNeeds(self): - for pkg in ['authconfig', 'chkconfig', 'system-config-firewall-base']: - self.selectPackage(pkg) + def selectAnacondaNeeds(self, anaconda): + # Only add in chkconfig if they did something that needs it. + if anaconda.isKickstart and (anaconda.id.ksdata.services.disabled or + anaconda.id.ksdata.services.enabled) or \ + anaconda.id.storage.services or anaconda.id.network.hasActiveIPoIBDevice(): + self.selectPackage("chkconfig")
def doPostSelection(self, anaconda): # Only solve dependencies on the way through the installer, not the way back. @@ -1618,7 +1617,7 @@ debuglevel=6 self.selectFSPackages(anaconda.id.storage) if anaconda.id.network.hasActiveIPoIBDevice(): self.selectPackage("rdma") - self.selectAnacondaNeeds() + self.selectAnacondaNeeds(anaconda) else: self.ayum.update()
If provided, this takes precedence over all other bootloader options. In anaconda, it is intended that this option completely skip all bootloader operations - nothing should be installed to disk, and the bootloader package should not even be installed.
Related: rhbz#1125410 --- pykickstart/commands/bootloader.py | 13 +++++++++---- tests/commands/bootloader.py | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py index e64bbbc..7049d20 100644 --- a/pykickstart/commands/bootloader.py +++ b/pykickstart/commands/bootloader.py @@ -1,7 +1,7 @@ # # Chris Lumens clumens@redhat.com # -# Copyright 2007 Red Hat, Inc. +# Copyright 2007, 2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU @@ -189,12 +189,16 @@ class RHEL6_Bootloader(F12_Bootloader): F12_Bootloader.__init__(self, writePriority, *args, **kwargs)
self.isCrypted = kwargs.get("isCrypted", False) + self.disabled = kwargs.get("disabled", False)
def _getArgsAsStr(self): - ret = F12_Bootloader._getArgsAsStr(self) + if self.disabled: + ret = " --disabled" + else: + ret = F12_Bootloader._getArgsAsStr(self)
- if self.isCrypted: - ret += " --iscrypted" + if self.isCrypted: + ret += " --iscrypted"
return ret
@@ -206,6 +210,7 @@ class RHEL6_Bootloader(F12_Bootloader): op = F12_Bootloader._getParser(self) op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False) op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string") + op.add_option("--disabled", dest="disabled", action="store_true", default=False) return op
class RHEL5_Bootloader(FC4_Bootloader): diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py index db6f1d0..4c2ae78 100644 --- a/tests/commands/bootloader.py +++ b/tests/commands/bootloader.py @@ -1,7 +1,7 @@ # # Chris Lumens clumens@redhat.com # -# Copyright 2009 Red Hat, Inc. +# Copyright 2009, 2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU @@ -120,5 +120,8 @@ class RHEL6_TestCase(F12_TestCase): self.assert_parse("bootloader --password=blahblah --iscrypted", "bootloader --location=mbr --password="blahblah" --iscrypted\n") self.assert_parse("bootloader --md5pass=blahblah", "bootloader --location=mbr --password="blahblah" --iscrypted\n")
+ self.assert_parse("bootloader --disabled", "bootloader --disabled\n") + self.assert_parse("bootloader --location=mbr --disabled", "bootloader --disabled\n") + if __name__ == "__main__": unittest.main()
Use this one wisely - it may result in a system that doesn't do anything.
Resolves: rhbz#1125410 --- pykickstart/parser.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/pykickstart/parser.py b/pykickstart/parser.py index 18e7559..f71de9f 100644 --- a/pykickstart/parser.py +++ b/pykickstart/parser.py @@ -249,6 +249,9 @@ class Packages(KickstartObject):
addBase -- Should the Base group be installed even if it is not specified? + nocore -- Should the Core group be skipped? This results in + a %packages section that basically only installs the + packages you list, and may not be a usable system. default -- Should the default package set be selected? excludedList -- A list of all the packages marked for exclusion in the %packages section, without the leading minus @@ -271,6 +274,7 @@ class Packages(KickstartObject): KickstartObject.__init__(self, *args, **kwargs)
self.addBase = True + self.nocore = False self.default = False self.excludedList = [] self.excludedGroupList = [] @@ -316,6 +320,8 @@ class Packages(KickstartObject): retval += " --excludedocs" if not self.addBase: retval += " --nobase" + if self.nocore: + retval += " --nocore" if self.handleMissing == KS_MISSING_IGNORE: retval += " --ignoremissing" if self.instLangs: @@ -494,6 +500,8 @@ class KickstartParser: action="store_true", default=False) op.add_option("--nobase", dest="nobase", action="store_true", default=False) + op.add_option("--nocore", dest="nocore", action="store_true", + default=False, introduced=RHEL6) op.add_option("--ignoredeps", dest="resolveDeps", action="store_false", deprecated=FC4, removed=F9) op.add_option("--resolvedeps", dest="resolveDeps", action="store_true", @@ -505,8 +513,15 @@ class KickstartParser:
(opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
+ if opts.defaultPackages and opts.nobase: + raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nobase cannot be used together"))) + elif opts.defaultPackages and opts.nocore: + raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nocore cannot be used together"))) + self.handler.packages.excludeDocs = opts.excludedocs self.handler.packages.addBase = not opts.nobase + self.handler.packages.nocore = opts.nocore + if opts.ignoremissing: self.handler.packages.handleMissing = KS_MISSING_IGNORE else:
If provided, this takes precedence over all other bootloader options. In anaconda, it is intended that this option completely skip all bootloader operations - nothing should be installed to disk, and the bootloader package should not even be installed.
Related: rhbz#1125410
Note that these two pykickstart patches will also require me to modify things on master (and rhel7-branch) to indicate that support was added for RHEL6.
- Chris
These all (even the nested ones) look good to me.
anaconda-patches@lists.fedorahosted.org