0

I'm currently installing RHEL 6 using a kickstart file. I'm attempting to conditionally install a package. The order of when the package is installed does not matter to me.

Right now, my %post section looks like this

%post

if [ conditionExists ]
then
    yum install packagename
fi

However, this does not work. My assumption is that yum is failing due to the fact that it is no longer pointing to the repo on the installation media, and instead pointing at the repo on the system.

What options are available when it comes to this problem? Is there a way to point the yum repo back to the installation media in the %post section? Is there a way to install the package in the %pre section without having an issue?

Brian5193
  • 1
  • 1
  • 3
  • Unfortunately 'does not work' does not provide enough information about the problem. Anybody trying to help you will require at a very least the error messages you see when performing an installation. – dawud Dec 06 '16 at 15:48
  • Hi @dawud it says that "Yum can't find the specified package". I can confirm that the package definitely is in the yum repo local to the installation media. When I add the package into the %packages section of the kickstart file, it installs just fine. – Brian5193 Dec 06 '16 at 15:52
  • This is something that I would do after installation, in configuration management. – Michael Hampton Dec 06 '16 at 18:54

1 Answers1

1

It should be:

yum install -y packagename

To avoid yum stopping to prompt for confirmation

Bruno9779
  • 182
  • 1
  • 1
  • 13