Script to ask Network configuration via kickstart

%pre
#!/bin/bash
echo -n "Enter FQDN Hostname: " > /dev/tty1
read HOSTN
echo -n "Enter IP Address:" > /dev/tty1
read IP
echo -n "Enter the Netmask:" > /dev/tty1
read MASK
echo -n "Enter Gateway:" > /dev/tty1
read GW
echo -n "Enter Nameserver:" > /dev/tty1
read DNS
echo "network --device eth0 --bootproto=static --ip=${IP} --netmask=${MASK} --gateway=${GW} --nameserver=${DNS} --hostname=${HOSTN}" > /tmp/network.txt

%post --noroot
#!/bin/bash
# bring in hostname collected from %pre, then source it
######
cp -Rvf /etc/sysconfig/network /mnt/sysimage/etc/sysconfig/network
cp -Rvf /etc/sysconfig/resolv.conf /mnt/sysimage/etc/resolv.conf
# Set-up eth0 with hostname
cp /etc/sysconfig/network-scripts/ifcfg-eth0  /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eth0



# force hostname change
/mnt/sysimage/bin/hostname $HOSTNAME
rhn-profile-sync

Comments

Post a Comment

Popular posts from this blog

How to clean all the foreman task and locked task

How to restrict users to send only mail to the local domain in Zimbra

Hardening Script