I've been looking around, and haven't yet seen an example of anyone using logic to determine packages/package group selections for options beneath %packages
. I'm trying to have kickstart install packages based on criteria discovered in %pre
, for instance:
%pre
if [ "$(/usr/sbin/dmidecode -s system-manufacturer)" = 'Dell Inc.' ]; then
echo 'srvadmin-all'
elif [ "$(/usr/sbin/dmidecode -s system-manufacturer)" = 'VMware, Inc.' ]; then
echo 'open-vm-tools'
fi
%end
I've never seen an example of conditional logic in the %packages
section, but I was thinking about printing all of the output into a file that is referenced with an %include
statement but I've had issues with %include
under %packages
since RHEL7.
I'm curious to know if there are any other methods anyone is using successfully along these lines.
You can use kickstart's ability to include files to accomplish this. Use your
%pre
section to write a file containing the packages you want, and then include the file in the%packages
section.For example: