Centos – Possible to run system-config-network during %post kickstart

centoscobblerkickstart

I'm currently trying to figure out a smart way to set IP, hostname, gateway and DNS settings during a kickstart (with user input during the kickstart). Doing this with firstboot after the install is not acceptable, so this must be done during %post.

I've tried to run the system-config-network tool during post in tty6:

#!/bin/sh  
chvt 6  
exec < /dev/tty6 > /dev/tty6  
/mnt/sysimage/usr/bin/system-config-network-tui  

This doesn't work since for some reason I'm unable to catch user input.

I would prefer to use built in tools to change this during post, rather than write my own bash script to do this, since using the provided tools is less likely to break anything.

Does someone done anything like this or similar, and made it work?

Thanks

Best Answer

Well this is stupid. I use cobbler which already have support for setting hostname, ip, subnet and dns information. You have to add it as a system, like this:

cobbler system add --name=[...] --profile=[...]--ip=10.1.1.2 --gateway=10.1.1.1 --hostname=yourhostname.exmaple.org --name-servers="10.1.1.1" --static=true --mac=00:50:56:af:56:22

Cobbler then have a snippet that applies this for you, called "post_install_network_config". Let me know if anyone have any questions.