Re: ks] Re: Kickstart question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have somehting similar however rather than PHP - I just use a simple shell 
script as a cgi script.
   It takes the IP address of the calling host from the shell environment  
then 'cat's a template kickstart file to stdout. It pipes this though sed to 
replace placeholders in the kickstart with the actual IP addresses to use.

I also have 2 enhancements:
  1. I also check the calling IP address and can use a different template 
kickstart file based on which IP range it is 
 2.   I can add options to the ks=http:/.../gimmeakick line for more tuning 
for example I can add '?RHver=8.0'   so that the shell cgi script can deliver 
Rh8.0 rather than the default RH7.3 (needs a mathcing kerenl/initrd too 
though)


Daniel.






On Thursday 29 May 2003 10:07 pm, R P Herrold wrote:
> On Thu, 29 May 2003, Richard Black wrote:
> > Some methods involve having a web server that can punch out diskettes
> > based on choices the user makes.  Well, that's not what you want, ok,
> > next...
>
> <snip>
>
> > Not sure how to do the ip address questioning, other than just leave
> > that section out of the ks.cfg (so throw an appropriately named
> > ks=nfs:192.168.0.1:/var/ftp/pub/kickstart/ks-rh73.cfg) on each of the
> > above append= lines).
>
> It turns out that one may use PHP (which can determine
> requesting IP (and if within the same subnet, requesting MAC
> address as well), and generate a config file on the fly ...:
>
> [herrold@ftp pxelinux.cfg]$ pwd ; grep php *
> /tftpboot/rhl/pxe/pxelinux.cfg
> 0A-80:    append ksdevice=eth0 load_ramdisk=1
> 	prompt_ramdisk=0 ramdisk_size=16384 initrd=initrd.img network
> 	ks=http://10.250.0.253/pub/kickstart/ks.php
> 0A-8094:    append ksdevice=eth0 ramdisk_size=32768
> 	initrd=initrd.img ks=http://10.250.0.253/pub/kickstart/ks.php
> 0A-90:    append ksdevice=eth0 load_ramdisk=1
> 	prompt_ramdisk=0 ramdisk_size=16384 initrd=initrd.img network
> 	ks=http://10.250.0.253/pub/kickstart/ks.php
> [herrold@ftp pxelinux.cfg]$
>
>
> and at: http://10.250.0.253/pub/kickstart/ks.php  sample code
> looks like:
>
> [root@ftp kickstart]# pwd ; ls ; cat ks.php
> /var/www/html/pub/kickstart
> default.cfg       ks.cfg       ks.cfg-80-plain  ks.cfg-LTSP
> ks.php
> done.php          ks.cfg-80    ks.cfg-80-post   ks-IP.php
> ftp-manifest.txt  ks.cfg-8094  ks.cfg-90        ks-MAC.php
> <?php
> //
> //      build a ks.cfg on the fly, based on IP
> //
> $FILENAME = "ks.cfg";
> $body = "";
> if (file_exists ("$FILENAME")) {
>         $fd = fopen ("$FILENAME", "r");
>         while (!feof ($fd)) {
>                 $buffer = fgets($fd, 4096);
>                 $body .= $buffer;
>                 }
>         fclose ($fd);
>         }
> //
> print "$body";
> print "reboot \n";
> //
> $recipient = "notify@xxxxxxxxxxxx";
> $subject = "PXE install - start";
> $body = "";
> $body .= "Install starts \n";
> $body .= "----------------------------------------- \n";
> $body .= "end of file";
> //
> mail ($recipient,$subject,$body) ;
> //
> [root@ftp kickstart]#
>
>
> and not surprisingly done.php is read in a %post section:
>
> [root@ftp kickstart]# cat done.php
> <?php
> //
> //      send an EOJ notice after an install
> //
> $recipient = "notify@xxxxxxxxxxxx";
> $subject = "PXE install done ";
> $body = "";
> $body .= "Install done \n";
> $body .= "----------------------------------------- \n";
> $FILENAME = "ks.cfg";
> if (file_exists ("$FILENAME")) {
>         $fd = fopen ("$FILENAME", "r");
>         while (!feof ($fd)) {
>                 $buffer = fgets($fd, 4096);
>                 $body .= $buffer;
>                 }
>         fclose ($fd);
> //      $null = "-placeholder- \n";
>         } else {
>         $body .= "kickstart file missing \n";
>         }
> $body .= "----------------------------------------- \n";
> $body .= "end of file";
> //
> mail ($recipient,$subject,$body) ;
> //
> header("Location: http://www.owlriver.com/";);
> //
> [root@ftp kickstart]#
>
>
> with code like this:
>
> [root@ftp kickstart]# tail ks.cfg-90
> #       for tftp install notifications
> sox
> libogg
> libvorbis
> -lokkit
> -mutt
>
> %post
> wget -O /dev/null -U "orc/9.0" http://10.250.0.253/pub/kickstart/done.php
> [root@ftp kickstart]#
>
> ----------------------------------
>
> I am getting a wierd hangup sometimes, but I think this may be
> hardware related.
>
> -- Russ Herrold

-- 
Yours,
Daniel.

--------------------------------------------------------------
Dr. Dan Kidger, Quadrics Ltd.      daniel.kidger@xxxxxxxxxxxx
One Bridewell St., Bristol, BS1 2AA, UK         0117 915 5505
----------------------- www.quadrics.com --------------------






[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux