Re: ks] Re: Kickstart question

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

 



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

-- 
end
======================================+
 .-- -... ---.. ... -.- -.--          |
 Copyright (C) 2003 R P Herrold       | Owl River Company
 herrold@xxxxxxxxxxxx  NIC: RPH5 (US) | "The World is Open to Linux (tm)"
   My words are not deathless prose,  | Open Source LINUX solutions ...
      but they are mine.              | info@xxxxxxxxxxxx -- Columbus, OH
 gpg --keyserver pgp.mit.edu --recv-key 0x7BFB98B9 
 gpg --list-keys 2> /dev/null | grep 7BFB98B9




[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