1

I'm attempting to achieve a hands off Linux installation with minimal input from the user. I've been successful so far with the exception of including the network parameters. I've included within my Kickstart the following code:

%include /tmp/network.txt 

%pre
#!/bin/bash
exec < /dev/tty3 > /dev/tty3 2>&1
chvt 3
HOSTNAME=""
IPADDR=""
NETMASK=""
GATEWAY=""

while [ "$HOSTNAME" == "" ]; do
        clear
        echo " *** Please enter the hostname: *** "
        echo
        read -p "Hostname: " HOSTNAME
done
clear
while [ "$IPADDR" == "" ]; do
        echo " *** Please enter the IP address: ***"
        echo
        read -p "IP Address: " IPADDR
done
clear
while [ "$NETMASK" == "" ]; do
        echo " *** Please enter the netmask: ***"
        echo
        read -p "Netmask: " NETMASK
done
clear
while [ "$GATEWAY" == "" ]; do
        echo " *** Please enter default gateway: ***"
        echo
        read -p "Default Gateway: " GATEWAY
done
clear
chvt 1
echo "network --device eth0 --bootproto static --noipv6 --hostname=${HOSTNAME} --ip=${IPADDR} --netmask=${NETMASK} --gateway=${GATEWAY}" > /tmp/network.txt
%end

Which works fine. I can see the relevant prompts i.e. hostname, ipaddr and netmask during the installation. There are probably better ways to gather this type of information but at this point I'm just trying to capture it and use it accordingly. The problem I have is that the pre script always kicks in after the point where the anaconda installer normally asks for this type of information (Manual TCP/IP Configuration). No matter where I place the %include /tmp/network.txt it seems I always see the manual TCP/IP section of the installer prior to the output of the pre script. I've yet to check the contents of the /tmp/network.txt file and ensure everything is correct so I'll do that next.

Any pointers; simular experiences and tips would be greatly appreciated.

Thanks, DJC.

djc72uk
  • 33
  • 1
  • 6
  • Why are you trying to do this? – Michael Hampton Nov 15 '16 at 21:57
  • So that during installation all that needs to be entered by the user is the network parameters. – djc72uk Nov 15 '16 at 22:01
  • But Anaconda will already ask for this information! – Michael Hampton Nov 15 '16 at 22:02
  • Yes I know that. But I need a way to enter the hostname as I'm not prompted for that via anaconda. So, my rational is to have all the relevant information entered the same way via the pre script. – djc72uk Nov 15 '16 at 22:06
  • What Linux distribution are you using that doesn't ask for the hostname? Every version of anaconda I've ever seen has always asked for the hostname. – Michael Hampton Nov 15 '16 at 22:09
  • RHEL 6.x I always end up with the hostname localhost. My installation only asks me for manual TCP/IP selection but no hostname. I can send you the entire KS file if you wish to review? – djc72uk Nov 15 '16 at 22:15
  • Is there a reason why you cannot apply the network configurations in the post-script section? – Brett Levene Nov 15 '16 at 22:26
  • Oh.... right. The installer in RHEL 6 only asks for the hostname in graphical mode, but not in text mode. In RHEL 7, it asks in both graphical and text modes. – Michael Hampton Nov 15 '16 at 22:42
  • I can live with having the native anaconda means for entering TCP/IP and a pre script for entering a hostname. The only problem with that is that I can't seem to bypass the procedure prior to TCP/IP where you're asked to highlight whether a static IP address is to be assigned or via DHCP etc. – djc72uk Nov 16 '16 at 12:41

0 Answers0