]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
di_special_kernel: Provide $tp; Regularise $kernel, $cpio
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 14 Dec 2017 15:52:07 +0000 (15:52 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 14 Dec 2017 15:54:20 +0000 (15:54 +0000)
Make both of these paths relative to $ho->{Tftp}{Path}.  Previously
$kernel was relative to that, but $cpio contained it.

Adjust all callers, so no functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/Debian.pm
ts-host-install

index 889cb0eb26c4ebb290165ea32aff3b99b88a1c40..baaab907f8c935b38f551e6f22e3dad55f6b1ec9 100644 (file)
@@ -1056,32 +1056,36 @@ sub di_installer_path ($) {
 
 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);
     }
 }
 
index d83d81b31ca2707280cef1f88ac5ed696ff1f872..c5b92b8d097f8522e147b4d965ad5ffba36a1b24 100755 (executable)
@@ -182,9 +182,9 @@ sub setup_netboot_firstboot($) {
     }
 
     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;
@@ -215,9 +215,9 @@ END
     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"