Run init command each time compile command is executed
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 12 Apr 2023 15:37:10 +0000 (11:37 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Thu, 1 Jun 2023 19:16:14 +0000 (15:16 -0400)
Running init command only once before the temporary git branch is
created can create an invalid configuration file.

scripts/kernel-send-patches.sh

index 28af710..07c725e 100755 (executable)
@@ -214,10 +214,6 @@ rm -rf ${srcdir}/*.patch
 # If the cover letter is not between start and end commits, save a copy:
 cp ${srcdir}/cover-letter.txt /tmp
 
-if [ x"${init_cmd}" != x"" ]; then
-    ${init_cmd}
-fi
-
 patches_branch="kernel_send_patches"
 
 if [ x"${series}" != x"" ]; then
@@ -287,9 +283,13 @@ cat > ${compile_script} << "EOF"
 # Do not edit, auto-generated script
 echo
 echo "Testing commit: $(git log --oneline | head -n 1)"
+#INIT_CMD
 COMPILE_CMD
 EOF
 
+if [ x"${init_cmd}" != x"" ]; then
+    sed -i -e "s@.*INIT_CMD@${init_cmd}@" ${compile_script}
+fi
 sed -i -e "s@COMPILE_CMD@${compile_cmd}@" ${compile_script}
 chmod u+x ${compile_script}