Re: Scripting the url --url install method?

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

 



-----BEGIN PGP SIGNED MESSAGE-----
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=1.1.1.2 netmask=255.255.255.0 gateway=1.1.1.1 dns=1.1.1.3
>
> 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):
#!/usr/bin/perl

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 = "http://127.0.0.1:9300/$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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFJ0RqE7pTtanQdBU4RAl0lAJ9t9TVGNrlaQhfj+APgvSM1zD3MQQCfeYar
rOozIZ0DjRqWxc6d/zE7pSY=
=HQq4
-----END PGP SIGNATURE-----

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[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