Problem
You want a list of RPMs installed on a system. You don't want the version number of the RPM, you just want a list of package names.
Solution
# rpm -qa | sed -e 's/-[^-]*-[^-]*$//' | sort | uniq > rpmlist.txt
The
uniq is there to strip out multiple listings of the same RPM, if you have both the i386 and x86_64 versions installed, for example.
This works because all RPMs have at least two dashes in their names, the second-last of which is the beginning of the version. So you look for the second-last dash and strip off that and everything following it.
Easier
There's always an easier way, isn't there?
# rpm -qa --queryformat '%{NAME}\n'
If you care about architecture (ie for x86_64 systems which have some i386 RPMs installed):
# rpm -qa --queryformat '%{NAME}.%{ARCH}\n'
These can be specified exactly the same way in the kickstart file.