Skip to content

Commit e5c2ec1

Browse files
Steven Rostedtrostedt
authored andcommitted
ktest: Add PRE_INSTALL option
Add the PRE_INSTALL option that will allow a user to specify a shell command to be executed before the install operation executes. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 921ed4c commit e5c2ec1

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
my $grub_number;
107107
my $target;
108108
my $make;
109+
my $pre_install;
109110
my $post_install;
110111
my $no_install;
111112
my $noclean;
@@ -225,6 +226,7 @@
225226
"ADD_CONFIG" => \$addconfig,
226227
"REBOOT_TYPE" => \$reboot_type,
227228
"GRUB_MENU" => \$grub_menu,
229+
"PRE_INSTALL" => \$pre_install,
228230
"POST_INSTALL" => \$post_install,
229231
"NO_INSTALL" => \$no_install,
230232
"REBOOT_SCRIPT" => \$reboot_script,
@@ -1669,6 +1671,12 @@ sub install {
16691671

16701672
return if ($no_install);
16711673

1674+
if (defined($pre_install)) {
1675+
my $cp_pre_install = eval_kernel_version $pre_install;
1676+
run_command "$cp_pre_install" or
1677+
dodie "Failed to run pre install";
1678+
}
1679+
16721680
my $cp_target = eval_kernel_version $target_image;
16731681

16741682
run_scp_install "$outputdir/$build_target", "$cp_target" or

‎tools/testing/ktest/sample.conf‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,14 @@
426426
# (default "")
427427
#BUILD_OPTIONS = -j20
428428

429+
# If you need to do some special handling before installing
430+
# you can add a script with this option.
431+
# The environment variable KERNEL_VERSION will be set to the
432+
# kernel version that is used.
433+
#
434+
# default (undefined)
435+
#PRE_INSTALL = ssh user@target rm -rf '/lib/modules/*-test*'
436+
429437
# If you need an initrd, you can add a script or code here to install
430438
# it. The environment variable KERNEL_VERSION will be set to the
431439
# kernel version that is used. Remember to add the initrd line

0 commit comments

Comments
 (0)