From 4e3b7d85bb195162cbaec3b140530f3076dc4858 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 21 Jun 2005 12:38:44 +0000 Subject: - add profiles_exist - enhance find_next_profile_name - add_empty_profile now needs a profile name --- perl-install/network/pxe.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'perl-install/network/pxe.pm') diff --git a/perl-install/network/pxe.pm b/perl-install/network/pxe.pm index a75aa18eb..ec0d1de53 100644 --- a/perl-install/network/pxe.pm +++ b/perl-install/network/pxe.pm @@ -239,16 +239,21 @@ sub list_pxelinux_profiles { sort(uniq(map { keys %{$profiles_conf->{profiles}{$_}} } qw(boot install))); } +sub profiles_exist { + my ($profiles_conf, $profile) = @_; + member($profile, network::pxe::list_pxelinux_profiles($profiles_conf)); +} + sub find_next_profile_name { my ($profiles_conf, $prefix) = @_; - my $i = 1; - /^$prefix(\d+)$/ && $1 >= $i and $i = $1 + 1 foreach network::pxe::list_pxelinux_profiles($profiles_conf); + my $i = undef; + /^$prefix(\d*)$/ && $1 >= $i and $i = $1 + 1 foreach network::pxe::list_pxelinux_profiles($profiles_conf); "$prefix$i"; } sub add_empty_profile { - my ($profiles_conf) = @_; - my $profile = find_next_profile_name($profiles_conf, "profile_"); + my ($profiles_conf, $profile, $to_install) = @_; + $to_install and $profiles_conf->{profiles}{install}{$profile} = 1; $profiles_conf->{profiles}{boot}{$profile} = 1; } -- cgit v1.2.1