19 |
confess "$ip not IP" unless $ip =~ m{^\d+\.\d+\.\d+\.\d+$}; |
confess "$ip not IP" unless $ip =~ m{^\d+\.\d+\.\d+\.\d+$}; |
20 |
|
|
21 |
$path_prefix = (caller(1))[3]; |
$path_prefix = (caller(1))[3]; |
22 |
$path_prefix =~ s{config::}{} || die "caller isn't package config !"; |
$path_prefix = (caller(2))[3] unless $path_prefix =~ m{config::}; |
23 |
|
$path_prefix =~ s{config::}{} || warn "# caller isn't package config !"; |
24 |
$path_prefix .= '/'; |
$path_prefix .= '/'; |
25 |
|
|
26 |
warn "# $ip $path_prefix"; |
warn "# $ip $path_prefix"; |
45 |
return $config; |
return $config; |
46 |
} |
} |
47 |
|
|
48 |
|
sub config_ip_boot { |
49 |
|
my ( $ip, $boot, $append ) = @_; |
50 |
|
|
51 |
|
my $default; |
52 |
|
my $config; |
53 |
|
|
54 |
|
foreach my $kernel ( glob "$boot/vmlinuz*" ) { |
55 |
|
my $ver = $1 if $kernel =~ m{vmlinuz(.+)}; |
56 |
|
$default ||= $ver; |
57 |
|
|
58 |
|
$config .= qq{ |
59 |
|
|
60 |
|
label boot$ver |
61 |
|
kernel $ip/boot/vmlinuz$ver |
62 |
|
append initrd=$ip/boot/initrd.img$ver $append |
63 |
|
|
64 |
|
}; |
65 |
|
} |
66 |
|
|
67 |
|
config_for_ip( $ip, qq{ |
68 |
|
|
69 |
|
default boot$default |
70 |
|
prompt 5 |
71 |
|
|
72 |
|
$config |
73 |
|
|
74 |
|
}); |
75 |
|
|
76 |
|
} |
77 |
|
|
78 |
1; |
1; |