ktest: Evaluate $KERNEL_VERSION in both install and post install
authorSteven Rostedt <srostedt@redhat.com>
Thu, 22 Dec 2011 16:25:46 +0000 (11:25 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 23 Dec 2011 02:59:33 +0000 (21:59 -0500)
The install process may also need to know what the kernel version
is, to add it to the name. Evaluate it for both install and
post install.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl

index 5d82c275e9e62b67b22ee083cae7131926170103..59738aa6ca7310e278dc01a5f68f5e891cc7c943 100755 (executable)
@@ -1434,12 +1434,19 @@ sub monitor {
     return 1;
 }
 
+sub eval_kernel_version {
+    my ($option) = @_;
+
+    $option =~ s/\$KERNEL_VERSION/$version/g;
+
+    return $option;
+}
+
 sub do_post_install {
 
     return if (!defined($post_install));
 
-    my $cp_post_install = $post_install;
-    $cp_post_install =~ s/\$KERNEL_VERSION/$version/g;
+    my $cp_post_install = eval_kernel_version $post_install;
     run_command "$cp_post_install" or
        dodie "Failed to run post install";
 }
@@ -1448,7 +1455,9 @@ sub install {
 
     return if ($no_install);
 
-    run_scp "$outputdir/$build_target", "$target_image" or
+    my $cp_target = eval_kernel_version $target_image;
+
+    run_scp "$outputdir/$build_target", "$cp_target" or
        dodie "failed to copy image";
 
     my $install_mods = 0;