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
#!/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
Is this applicable for version 6 or 7 or both??
ReplyDelete