Is it possible to use a %pre script in any way to customize the install method? I'm attempting to create a kickstart file that we can move around our network, however, some of our networks require different URL's to grab the ks file and to find the install media.
What I have currently isn't working as anaconda doesn't seem to like that it can't find the install method before it runs the %pre section.
Here is what I have currently -
install
%include /tmp/url
...
%pre
# Append network hostname as some tiers don't have DNS - if we don't have DNS
# then the hostname becomes 'localhost' when using the network information from the
# boot line
HOSTNAME=$( cat /proc/cmdline | sed -e s'/ /\n/g' | grep '^hostname=' )
echo "network --${HOSTNAME}" > /tmp/hostname
# Get our architecture
ARCH=$(uname -i)
# Figure out the kickstart URL from the boot line so we can find the install media
KSURL=$(cat /proc/cmdline | sed -e 's/ /\n/g' | grep '^ks=' | cut -d= -f2 | cut -d/ -f1,2,3)
echo "url --url=${KSURL}/yum/rhel5-server-${ARCH}/disc1" > /tmp/url
...
We boot from the DVD and enter the network information on the linux: boot command, so ultimately our boot line looks something like:
linux ks=http://yum.example.com:9300/ks/hp-rhel5.cfg hostname=test1.example.com ip=1.1.1.2 netmask=255.255.255.0 gateway=1.1.1.1 dns=1.1.1.3
I don't see any errors when viewing the logs - it just prompts me for the install method.
I've also tried something like the following in hopes that when it re-read the kickstart file, the URL line existed and it would use that instead - unfortunately that didn't work either.
install
%include /tmp/url
cdrom