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

Re: Scripting the url --url install method?

Hash: SHA1

Hajducko, Steven wrote:
> Is it possible to use a %pre script in any way to customize the install
> method?

No, anaconda wants the url to be in the ks.cfg when it's read.

> We boot from the DVD and enter the network information on the linux: boot
> command, so ultimately our boot line looks something like:
> linux ks=http://yum.example.com:9300/ks/hp-rhel5.cfg hostname=test1.example.com ip= netmask= gateway= dns=
> Any help would be greatly appreciated.

You could use a cgi wrapper to insert the proper hostname in the kickstart file
as it's sent to the client.

linux ks=http://yum.example.com:9300/cgi-bin/ks?ks=ks/hp-rhel5.cfg hostname=...

/var/www/cgi-bin/ks (Off the top of my head, I haven't tested this):

use strict;
use warnings;

use CGI qw/:standard/;
use LWP::Simple;

print "Content-type: text/plain\n\n";

if (url_param('ks')) {
  my $ks_file = url_param('ks');
  $ks_file =~ s/^\/*//;
  my $url = "$ks_file";;
  my $content = get($url);
  if ($content) {
    my $hostname = `hostname -f`;
    chomp $hostname;
    # Here is where you would mangle the url as you wish
    # I'm simply changing the hostname
    $content =~ s,^\s*url --url http://[^/]*,url --url http://$hostname:9300,m;
    print $content;

The kickstart file could have anything for the hostname in the --url line:
url --url http://THIS_WILL_BE_CHANGED/path/to/files

and the ks cgi would change to line to:
url --url http://yum.example.com:9300/path/to/files

as it's sent to the client.

You could change the ks cgi to mangle the url further in order to change the
path or port or whatever. I hardcoded the port above, but if you use different
ports you could make the cgi script detect on which port the request came in and
set that port in the output url as well. HTH.
- --
Kyle Powell | Red Hat | Senior Consultant, RHCE | Cell: 571.215.4340
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org


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