$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(debian_boot_setup
+ di_special_kernel
setupboot_bootloader_edited_rune
debian_overlays
debian_guest_suite debian_guest_di_version
return create_webfile($ho, "preseed$sfx", $preseed_file);
}
+sub di_special_kernel ($$$) {
+ my ($ho, $d_i, $fn) = @_;
+ # calls $fn->($kernel, $cpio) # either or both may be undef
+ 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";
+ } elsif ($! == &ENOENT) {
+ logm("warning: no kernel found for $kp at $kern");
+ } else {
+ die "$kp $kern $!";
+ }
+ my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz";
+ if (stat $cpio) {
+ logm("using kernel modules from: $cpio");
+ } elsif ($! == &ENOENT) {
+ logm("warning: no kernel module cpio found for $kp at $cpio");
+ $cpio = undef;
+ } else {
+ die "$kp $cpio $!";
+ }
+ $fn->($kernel, $cpio);
+ }
+}
+
sub preseed_create ($$;@) {
my ($ho, $sfx, %xopts) = @_;
}
}
- foreach my $kp (keys %{ $ho->{Flags} }) {
- # 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";
- } elsif ($! == &ENOENT) {
- logm("warning: no kernel found for $kp at $kern");
- } else {
- die "$kp $kern $!";
- }
-
- my $cpio= "$ho->{Tftp}{Path}/$d_i/$kp.cpio.gz";
- if (stat $cpio) {
- logm("using kernel modules from: $cpio");
- push @initrds, $cpio;
- } elsif ($! == &ENOENT) {
- logm("warning: no kernel module cpio found for $kp at $cpio");
- } else {
- die "$kp $cpio $!";
- }
- }
+ di_special_kernel($ho, $d_i, sub {
+ my ($k, $cpio) = @_;
+ $kernel = $k if defined $k;
+ push @initrds, $cpio if defined $cpio;
+ });
$kernel = "/$d_i/linux" unless $kernel;