[Spacewalk-list] Spacewalk-list Digest, Vol 55, Issue 49

Todd_Walters at unigroupinc.com Todd_Walters at unigroupinc.com
Fri Dec 21 14:08:02 UTC 2012


Kickstart Snippet to get hostname and network information.

Since we don't have pxe here i created my kickstart profiles, then build 
iso with 'cobbler buildiso' then I boot off that iso and have a menu. 

In my kickstarts I created the following snippet.  This asks for IP and 
Hostname, but you can uncomment the other stuff for different networks. I 
then put name my snippet 'pre_netcfg' and create a pre script in kickstart 
profile like this


Pre script in profile
$SNIPPET('spacewalk/1/pre_netcfg') 

and then make sure 'Template' is checked. This works very good and once 
system reboots it is setup with hostname and networking information.

-------- Snippet ----

%pre
#raw
clear
exec < /dev/tty6 > /dev/tty6 2> /dev/tty6
chvt 6

while true; do
echo "Enter Network Configuration"
echo "---------------------------"
echo " "
#echo -en "Enter Network Device (eth0,eth1)     : "
#read DEVICE
DEVICE=eth0

echo -en "Enter the Hostname?                  : "
read HOST

echo -en "Enter the IP Address?                : "
read IP

#echo -en "Enter the Netmask?                   : "
#read NETMASK
NETMASK=255.255.252.0

#echo -en "Enter the Gateway?                   : "
#read GATEWAY
GATEWAY=192.168.0.1

echo -e ""
echo -e "Please Review Your Entries "
echo -e "--------------------------"
echo -e "Network Device :  $DEVICE"
echo -e "Hostname       :  $HOST"
echo -e "IP Address     :  $IP"
echo -e "Netmask        :  $NETMASK"
echo -e "Gateway        :  $GATEWAY"
echo -e " "
echo -en "Does Everything Look Correct? (y/n) "
  read yn
  case $yn in
    y* | Y* )  line="network --bootproto static --device $DEVICE --ip $IP 
--netmask $NETMASK --hostname $HOST --gateway $GATEWAY"
ks="/tmp/ks.cfg"
sed -e "/^network/s/^network.*/$line/" $ks > ${ks}.tmp && mv ${ks}.tmp 
$ks; break;;
    [nN]* )   echo -e "Enter Network Configuration" ; continue;;
    q* ) exit ;;
    * ) echo "Enter yes or no" ;;
  esac
done

chvt 1
exec < /dev/tty1 > /dev/tty1 2> /dev/tty1
#endraw

--- end snippet --- 

Thanks,


Todd Walters
Sr System Software Programmer / Linux





------------------------------

Message: 2
Date: Thu, 20 Dec 2012 17:39:15 -0500
From: themaster001 <themaster001 at gmail.com>
To: spacewalk-list at redhat.com
Subject: [Spacewalk-list]  Help with kick-start.
Message-ID:
 <CAN45Sj+ww7UK7_zW6V7kkPBT+Rpb-+uAAzDesSX2PSEmWyOiFg at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Guys,

If this isn't the right place to ask, please let me know. I am stuck
need to get this working.




######################################################################## 
The information contained in this message, and any attachments thereto, 
is intended solely for the use of the addressee(s) and may contain 
confidential and/or privileged material.  Any review, retransmission, 
dissemination, copying, or other use of the transmitted information is 
prohibited.  If you received this in error, please contact the sender 
and delete the material from any computer.  UNIGROUPINC.COM 
########################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20121221/8d75bd65/attachment.htm>


More information about the Spacewalk-list mailing list