summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2005-07-11 18:06:01 +0000
committerStew Benedict <stewb@mandriva.org>2005-07-11 18:06:01 +0000
commitf7aa3845b7c212a5a4cce556325dd23cf213a4e1 (patch)
tree659c2c3528a913bddcfdbd8efc7a9ed6cea72692 /perl-install
parented71995148573bb4672e3d975fc4fd51ae048a23 (diff)
downloaddrakx-f7aa3845b7c212a5a4cce556325dd23cf213a4e1.tar
drakx-f7aa3845b7c212a5a4cce556325dd23cf213a4e1.tar.gz
drakx-f7aa3845b7c212a5a4cce556325dd23cf213a4e1.tar.bz2
drakx-f7aa3845b7c212a5a4cce556325dd23cf213a4e1.tar.xz
drakx-f7aa3845b7c212a5a4cce556325dd23cf213a4e1.zip
Add/remove entries to default PXE config.
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakTermServ36
1 files changed, 34 insertions, 2 deletions
diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ
index 5282ddfbe..986fe2c53 100755
--- a/perl-install/standalone/drakTermServ
+++ b/perl-install/standalone/drakTermServ
@@ -26,6 +26,7 @@ use ugtk2 qw(:helpers :wrappers :create);
use common;
use run_program;
use bootloader;
+use network::pxe;
use Config;
use POSIX;
@@ -828,7 +829,8 @@ sub clear_nbi {
if ($conf{CREATE_PXE}) {
my $pxe = get_platform_pxe();
$nbi =~ s|$tftpboot/|$pxe|;
- unlink($nbi);
+ unlink($nbi);
+ del_pxe_entry($nbi) if -d $pxe;
}
return $result;
}
@@ -840,7 +842,7 @@ sub update_list {
}
sub build_n_update {
- my ($list_model, $kernel, $nic, $kcount) = @_;
+ my ($list_model, $kernel, $nic) = @_;
my $command = "-k /boot/$kernel";
$command .= " -r $nic" if $nic;
run_program::run("$mknbi -v $command") or $in->ask_warn(N("Error"), N("%s failed", $mknbi));
@@ -849,11 +851,41 @@ sub build_n_update {
if (-d $pxedir) {
cp_af("/boot/$kernel", $pxedir) if !-f "$pxedir/$kernel";
link_pxe($kernel, $nic);
+ add_pxe_entry($kernel, $nic);
}
}
update_list($list_model);
}
+sub add_pxe_entry {
+ my ($kernel, $nic) = @_;
+ my $pxeconf = get_platform_pxe() . "pxelinux.cfg/default";
+ $kernel =~ s|vmlinuz-||;
+ my $label = uc($nic) . "." . uc($kernel);
+ my $conf = network::pxe::read_pxelinux_conf($pxeconf, undef);
+ push @{$conf->{entries}}, {label => $label , kernel => "vmlinuz-$kernel", initrd => "initrd-$nic.$kernel.img" };
+ network::pxe::write_pxelinux_conf($conf, $pxeconf);
+}
+
+sub del_pxe_entry {
+ my ($nbi) = @_;
+ my $pxeconf = get_platform_pxe() . "pxelinux.cfg/default";
+ $nbi = basename($nbi);
+ $nbi =~ s|initrd-||;
+ $nbi =~ s|.img||;
+ my $conf = network::pxe::read_pxelinux_conf($pxeconf, undef);
+
+ my $index = 0;
+ foreach (@{$conf->{entries}}) {
+ if ($_->{label} eq uc($nbi)) {
+ splice @{$conf->{entries}}, $index, 1;
+ last;
+ }
+ $index++;
+ }
+ network::pxe::write_pxelinux_conf($conf, $pxeconf);
+}
+
sub link_pxe {
my ($kernel, $nic) = @_;
my $pxedir = get_platform_pxe();