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