sub di_special_kernel ($$) {
my ($ho, $fn) = @_;
- # calls $fn->($kp, $kernel, $cpio) # $kernel and/or $cpio may be undef
+ # calls $fn->($kp, $tp, $kernel, $cpio)
+ # $kp is "special" or "backports" or similar
+ # $tp is $ho->{Tftp}{Path}, for convenience
+ # $kernel and/or $cpio may be undef, and do not contain $tp
my $d_i = di_installer_path($ho);
+ my $tp = $ho->{Tftp}{Path};
foreach my $kp (keys %{ $ho->{Flags} }) {
my $kernel;
# Backwards compatibility
$kp = "need-kernel-deb-wheezy-backports" if $kp eq "need-kernel-deb-armmp";
$kp =~ s/need-kernel-deb-$ho->{Suite}-// or next;
- my $kern= "$ho->{Tftp}{Path}/$d_i/linux.$kp";
- if (stat $kern) {
- logm("using kernel from: $kern");
- $kernel = "/$d_i/linux.$kp";
+ my $kernel= "$d_i/linux.$kp";
+ if (stat "$tp/$kernel") {
+ logm("using kernel from: $tp/$kernel");
} elsif ($! == &ENOENT) {
- logm("warning: no kernel found for $kp at $kern");
+ logm("warning: no kernel found for $kp at $tp/$kernel");
+ $kernel = undef;
} else {
- die "$kp $kern $!";
+ die "$kp $kernel $!";
}
- my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz";
- if (stat $cpio) {
- logm("using kernel modules from: $cpio");
+ my $cpio= "$d_i/$kp.cpio.gz";
+ if (stat "$tp/$cpio") {
+ logm("using kernel modules from: $tp/$cpio");
} elsif ($! == &ENOENT) {
- logm("warning: no kernel module cpio found for $kp at $cpio");
+ logm("warning: no kernel module cpio found for $kp at $tp/$cpio");
$cpio = undef;
} else {
die "$kp $cpio $!";
}
- $fn->($kp, $kernel, $cpio);
+ $fn->($kp, $tp, $kernel, $cpio);
}
}
}
di_special_kernel($ho, sub {
- my ($kp, $k, $cpio) = @_;
+ my ($kp, $tp, $k, $cpio) = @_;
$kernel = $k if defined $k;
- push @initrds, $cpio if defined $cpio;
+ push @initrds, "$tp/$cpio" if defined $cpio;
});
$kernel = "/$d_i/linux" unless $kernel;
my %xopts;
di_special_kernel($ho, sub {
- my ($kp,$k,$c) = @_;
+ my ($kp,$tp,$k,$c) = @_;
$xopts{dtbs} = "/$d_i/$kp-dtbs"
- if -e "$ho->{Tftp}{Path}/$d_i/$kp-dtbs";
+ if -e "$tp/$d_i/$kp-dtbs";
});
$xopts{dtbs} = "/$d_i/dtbs"