User Tools

Site Tools


os:linux:centos:kspostscript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
os:linux:centos:kspostscript [2011/10/27 20:33]
jay [%post]
os:linux:centos:kspostscript [2012/04/08 16:17] (current)
jay [%post]
Line 1: Line 1:
 ====== Interactive Post-install Script in Kickstart ====== ====== Interactive Post-install Script in Kickstart ======
 ===== About This Document ===== ===== About This Document =====
-As of this writing, I've been finishing up the process of setting up a PXE booting kickstart server (which I'm planning on doing a full writeup on soon).  After getting everything working in terms of bare metal to installed OS, I got to the point of tweaking my kickstart configs and when I wanted to set up the network info on the newly created OS, I ran into a snag.  +As of this writing, I'm just finishing up the process of setting up a PXE booting kickstart server (which I'm planning on doing a full writeup on soon).  After getting everything workingin terms of bare metal to installed OS, I got to the point of starting to tweak my kickstart configs.  And when I wanted to set up the network info on the newly created OS, I ran into a snag.  
  
-At my current job, we have a few Red Hat/CentOS servers scattered about, but we are mostly a FreeBSD shop.  We already had a home-brewed PXE boot installer for FreeBSD that was originally cobbled together years ago, but after a recent merger we were starting to hear whispers of having to build out more RH/CentOS so I figured I would hop on this mission as I was by far the best "Linux guy" we had.  Being that our FreeBSD installer was home-brewed, it was generally pretty simple to add in new functionality as the install system was just a bunch of shell scripts.  I had built an interactive menu into this system for configuring the network after the install quite some time ago, and I wanted to do the same thing with this new kickstart box for RH/CentOS.+At my current job, we have a few Red Hat/CentOS servers scattered about, but we are mostly a FreeBSD shop.  We already had a home-brewed PXE boot installer for FreeBSD that was originally cobbled together years ago, but after a recent merger we were starting to hear whispers of having to build out more RH/CentOSso I figured I would hop on this mission as I was by far the best "Linux guy" we had.  Being that our FreeBSD installer was home-brewed, it was generally pretty simple to add in new functionalityas the install system was just a bunch of shell scripts.  I had built an interactive menu into this system for configuring the network after the install quite some time ago, and I wanted to do the same thing with this new kickstart box for RH/CentOS.
  
-I noticed in initial testing that anything I was trying to output to the terminal was not showing up, but that I was able to read from the terminal.  After doing a little searching, I found that [[http://hintshop.ludvig.co.nz/show/interactive-pre-post-install-scripts-redhat-kickstart/|this post]] that gave me the jumpstart I needed to get this all straightened out.  That example would work just fine for when we are standing at the machine with a crash cart, but I also had configs set up to do the installs over a serial console, so the example there would not work for that.+I noticed in initial testing that anything I was trying to output to the terminal in the ''%post'' section of the kickstart file was not showing up, but that I was able to read from the terminal.  After doing a little searching, I found [[http://hintshop.ludvig.co.nz/show/interactive-pre-post-install-scripts-redhat-kickstart/|this post]] that gave me the jumpstart I needed to get this all straightened out.  The problem I had was that though the example would work just fine for when we are standing at the machine with a crash cart, I also had configs set up to do the installs over a serial console.  That example just wouldn'work for that situation.
  
 For the purposes of brevity, I'm going to assume you are already familiar with the kickstart system, have a server, etc.  I'm just going to cover the interactive input in the ''%post'' section of the kickstart file. For the purposes of brevity, I'm going to assume you are already familiar with the kickstart system, have a server, etc.  I'm just going to cover the interactive input in the ''%post'' section of the kickstart file.
Line 29: Line 29:
 clear clear
  
-while [ "x$answer" != "xy" ] && [ "x$answer" != "xY" ] ; do+while [ x"$answer" != "xy" ] && [ x"$answer" != "xY" ] ; do 
 +        echo -n "enter hostname: "; read hostname
         echo -n "enter ip: "; read ip         echo -n "enter ip: "; read ip
         echo -n "enter netmask: "; read netmask         echo -n "enter netmask: "; read netmask
Line 45: Line 46:
 done done
  
-if [ "x$opts" = "xy" ] ; then+if [ x"$opts" = "xy" ] ; then
         opts="speed 100 duplex full autoneg off"         opts="speed 100 duplex full autoneg off"
 else else
Line 64: Line 65:
 echo DNS1=$dns1 >> $scrFile echo DNS1=$dns1 >> $scrFile
 echo DNS2=$dns2 >> $scrFile echo DNS2=$dns2 >> $scrFile
 +
 +if [ "x$opts" != "x" ] ; then
 +        echo 'ETHTOOL_OPTS="'"$opts"'"' >> $scrFile
 +fi
 +
  
 %end %end
os/linux/centos/kspostscript.1319747605.txt.gz · Last modified: 2011/10/27 20:33 by jay