--- lib/PXElator/pxelinux.pm 2009/08/05 23:22:17 153 +++ lib/PXElator/pxelinux.pm 2010/01/03 01:19:50 463 @@ -19,7 +19,8 @@ confess "$ip not IP" unless $ip =~ m{^\d+\.\d+\.\d+\.\d+$}; $path_prefix = (caller(1))[3]; - $path_prefix =~ s{config::}{} || die "caller isn't package config !"; + $path_prefix = (caller(2))[3] unless $path_prefix =~ m{config::}; + $path_prefix =~ s{config::}{} || warn "# caller isn't package config !"; $path_prefix .= '/'; warn "# $ip $path_prefix"; @@ -44,4 +45,34 @@ return $config; } +sub config_ip_boot { + my ( $ip, $boot, $append ) = @_; + + my $default; + my $config; + + foreach my $kernel ( glob "$boot/vmlinuz*" ) { + my $ver = $1 if $kernel =~ m{vmlinuz(.+)}; + $default ||= $ver; + + $config .= qq{ + +label boot$ver + kernel $ip/boot/vmlinuz$ver + append initrd=$ip/boot/initrd.img$ver $append + + }; + } + + config_for_ip( $ip, qq{ + +default boot$default +prompt 5 + +$config + + }); + +} + 1;