bc092b
From a827807a1330d5ad619faa103bc7f12d89fc8bee Mon Sep 17 00:00:00 2001
bc092b
From: Vladimir Serbinenko <phcoder@gmail.com>
bc092b
Date: Sun, 22 Jan 2017 20:22:34 +0300
31cddd
Subject: [PATCH] Fix shebang for termux.
bc092b
bc092b
Termux doesn't have a /bin/sh. So we needto use $SHELL.
bc092b
Keep /bin/sh as much as possible.
bc092b
---
bc092b
 configure.ac                         | 10 ++++++++++
bc092b
 grub-core/genmod.sh.in               |  2 +-
bc092b
 grub-core/gensyminfo.sh.in           |  2 +-
bc092b
 grub-core/modinfo.sh.in              |  2 +-
bc092b
 tests/ahci_test.in                   |  2 +-
bc092b
 tests/btrfs_test.in                  |  2 +-
bc092b
 tests/cdboot_test.in                 |  2 +-
bc092b
 tests/core_compress_test.in          |  2 +-
bc092b
 tests/cpio_test.in                   |  2 +-
bc092b
 tests/ehci_test.in                   |  2 +-
bc092b
 tests/example_scripted_test.in       |  2 +-
bc092b
 tests/exfat_test.in                  |  2 +-
bc092b
 tests/ext234_test.in                 |  2 +-
bc092b
 tests/fat_test.in                    |  2 +-
bc092b
 tests/fddboot_test.in                |  2 +-
bc092b
 tests/file_filter_test.in            |  2 +-
bc092b
 tests/gettext_strings_test.in        |  2 +-
bc092b
 tests/grub_cmd_date.in               |  2 +-
bc092b
 tests/grub_cmd_regexp.in             |  2 +-
bc092b
 tests/grub_cmd_set_date.in           |  2 +-
bc092b
 tests/grub_cmd_sleep.in              |  2 +-
bc092b
 tests/grub_cmd_test.in               |  2 +-
bc092b
 tests/grub_cmd_tr.in                 |  2 +-
bc092b
 tests/grub_func_test.in              |  2 +-
bc092b
 tests/grub_script_blanklines.in      |  2 +-
bc092b
 tests/grub_script_blockarg.in        |  2 +-
bc092b
 tests/grub_script_dollar.in          |  2 +-
bc092b
 tests/grub_script_expansion.in       |  2 +-
bc092b
 tests/grub_script_final_semicolon.in |  2 +-
bc092b
 tests/grub_script_no_commands.in     |  2 +-
bc092b
 tests/gzcompress_test.in             |  2 +-
bc092b
 tests/hddboot_test.in                |  2 +-
bc092b
 tests/help_test.in                   |  2 +-
bc092b
 tests/hfs_test.in                    |  2 +-
bc092b
 tests/hfsplus_test.in                |  2 +-
bc092b
 tests/iso9660_test.in                |  2 +-
bc092b
 tests/jfs_test.in                    |  2 +-
bc092b
 tests/lzocompress_test.in            |  2 +-
bc092b
 tests/minixfs_test.in                |  2 +-
bc092b
 tests/netboot_test.in                |  2 +-
bc092b
 tests/nilfs2_test.in                 |  2 +-
bc092b
 tests/ntfs_test.in                   |  2 +-
bc092b
 tests/ohci_test.in                   |  2 +-
bc092b
 tests/partmap_test.in                |  2 +-
bc092b
 tests/pata_test.in                   |  2 +-
bc092b
 tests/pseries_test.in                |  2 +-
bc092b
 tests/reiserfs_test.in               |  2 +-
bc092b
 tests/romfs_test.in                  |  2 +-
bc092b
 tests/squashfs_test.in               |  2 +-
bc092b
 tests/syslinux_test.in               |  2 +-
bc092b
 tests/tar_test.in                    |  2 +-
bc092b
 tests/test_sha512sum.in              |  2 +-
bc092b
 tests/udf_test.in                    |  2 +-
bc092b
 tests/uhci_test.in                   |  2 +-
bc092b
 tests/util/grub-fs-tester.in         |  2 +-
bc092b
 tests/util/grub-shell-tester.in      |  2 +-
bc092b
 tests/util/grub-shell.in             |  2 +-
bc092b
 tests/xfs_test.in                    |  2 +-
bc092b
 tests/xzcompress_test.in             |  2 +-
bc092b
 tests/zfs_test.in                    |  2 +-
bc092b
 60 files changed, 69 insertions(+), 59 deletions(-)
bc092b
bc092b
diff --git a/configure.ac b/configure.ac
ec4acb
index e0262e159f0..ee2c86537e9 100644
bc092b
--- a/configure.ac
bc092b
+++ b/configure.ac
bc092b
@@ -459,6 +459,16 @@ case "$build_os" in
bc092b
 esac
bc092b
 AC_SUBST(BUILD_EXEEXT)
bc092b
 
bc092b
+# In some build environments like termux /bin/sh is not a valid
bc092b
+# shebang. Use $SHELL instead if it's executable and /bin/sh isn't
bc092b
+BUILD_SHEBANG=/bin/sh
bc092b
+for she in /bin/sh "$SHELL"; do
bc092b
+  if test -x "$she" ; then
bc092b
+    BUILD_SHEBANG="$she"
bc092b
+  fi
bc092b
+done
bc092b
+AC_SUBST(BUILD_SHEBANG)
bc092b
+
bc092b
 # For gnulib.
bc092b
 gl_INIT
bc092b
 
bc092b
diff --git a/grub-core/genmod.sh.in b/grub-core/genmod.sh.in
ec4acb
index 03cc3b7f69e..3de06ee018f 100644
bc092b
--- a/grub-core/genmod.sh.in
bc092b
+++ b/grub-core/genmod.sh.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Copyright (C) 2010 Free Software Foundation, Inc.
bc092b
diff --git a/grub-core/gensyminfo.sh.in b/grub-core/gensyminfo.sh.in
ec4acb
index 2e8716b425c..9bc7675327a 100644
bc092b
--- a/grub-core/gensyminfo.sh.in
bc092b
+++ b/grub-core/gensyminfo.sh.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Copyright (C) 2010 Free Software Foundation, Inc.
bc092b
diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in
ec4acb
index faf0ad30edb..f6cd657ce0f 100644
bc092b
--- a/grub-core/modinfo.sh.in
bc092b
+++ b/grub-core/modinfo.sh.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 # User-controllable options
bc092b
 grub_modinfo_target_cpu=@target_cpu@
bc092b
diff --git a/tests/ahci_test.in b/tests/ahci_test.in
ec4acb
index 1d01d1f59a0..7df56046201 100644
bc092b
--- a/tests/ahci_test.in
bc092b
+++ b/tests/ahci_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/btrfs_test.in b/tests/btrfs_test.in
ec4acb
index c55d9477f78..2b37ddd3324 100644
bc092b
--- a/tests/btrfs_test.in
bc092b
+++ b/tests/btrfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/cdboot_test.in b/tests/cdboot_test.in
ec4acb
index 1cc901977c2..75acdfedb7f 100644
bc092b
--- a/tests/cdboot_test.in
bc092b
+++ b/tests/cdboot_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/core_compress_test.in b/tests/core_compress_test.in
ec4acb
index 1003587ccca..9d216ebcff6 100644
bc092b
--- a/tests/core_compress_test.in
bc092b
+++ b/tests/core_compress_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/cpio_test.in b/tests/cpio_test.in
ec4acb
index 0b09db549f0..5742cf17b9d 100644
bc092b
--- a/tests/cpio_test.in
bc092b
+++ b/tests/cpio_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/ehci_test.in b/tests/ehci_test.in
ec4acb
index 7dd8d3e8fbd..b197f8cdc92 100644
bc092b
--- a/tests/ehci_test.in
bc092b
+++ b/tests/ehci_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/example_scripted_test.in b/tests/example_scripted_test.in
ec4acb
index 09633e89341..783b7f13853 100644
bc092b
--- a/tests/example_scripted_test.in
bc092b
+++ b/tests/example_scripted_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 true
bc092b
diff --git a/tests/exfat_test.in b/tests/exfat_test.in
ec4acb
index fc1a0fe5ec0..cd3cd4cb2f7 100644
bc092b
--- a/tests/exfat_test.in
bc092b
+++ b/tests/exfat_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/ext234_test.in b/tests/ext234_test.in
ec4acb
index c986960a8be..892b99cbdf6 100644
bc092b
--- a/tests/ext234_test.in
bc092b
+++ b/tests/ext234_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/fat_test.in b/tests/fat_test.in
ec4acb
index 1d132b51703..b6b4748ca69 100644
bc092b
--- a/tests/fat_test.in
bc092b
+++ b/tests/fat_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/fddboot_test.in b/tests/fddboot_test.in
ec4acb
index a59645b7f87..2d7dfc8891f 100644
bc092b
--- a/tests/fddboot_test.in
bc092b
+++ b/tests/fddboot_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/file_filter_test.in b/tests/file_filter_test.in
ec4acb
index 8909e4021fb..bfb6382274e 100644
bc092b
--- a/tests/file_filter_test.in
bc092b
+++ b/tests/file_filter_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2014  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/gettext_strings_test.in b/tests/gettext_strings_test.in
ec4acb
index 5c305e75b7e..813999ebe6e 100644
bc092b
--- a/tests/gettext_strings_test.in
bc092b
+++ b/tests/gettext_strings_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 cd '@srcdir@'
bc092b
 
bc092b
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in
ec4acb
index 60f039ebc8b..f7c9ca00432 100644
bc092b
--- a/tests/grub_cmd_date.in
bc092b
+++ b/tests/grub_cmd_date.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 . "@builddir@/grub-core/modinfo.sh"
bc092b
diff --git a/tests/grub_cmd_regexp.in b/tests/grub_cmd_regexp.in
ec4acb
index 7e9ab86aabb..6520bd6d79a 100644
bc092b
--- a/tests/grub_cmd_regexp.in
bc092b
+++ b/tests/grub_cmd_regexp.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Run GRUB script in a Qemu instance
bc092b
diff --git a/tests/grub_cmd_set_date.in b/tests/grub_cmd_set_date.in
ec4acb
index 2f518dd9e34..aac120a6c52 100644
bc092b
--- a/tests/grub_cmd_set_date.in
bc092b
+++ b/tests/grub_cmd_set_date.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 . "@builddir@/grub-core/modinfo.sh"
bc092b
diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in
ec4acb
index ac51d42098e..8797f663284 100644
bc092b
--- a/tests/grub_cmd_sleep.in
bc092b
+++ b/tests/grub_cmd_sleep.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 . "@builddir@/grub-core/modinfo.sh"
bc092b
diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in
ec4acb
index 49ae8a9c830..3399eb29294 100644
bc092b
--- a/tests/grub_cmd_test.in
bc092b
+++ b/tests/grub_cmd_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 
bc092b
 # create a randome file
bc092b
 empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
bc092b
diff --git a/tests/grub_cmd_tr.in b/tests/grub_cmd_tr.in
ec4acb
index 0e8d645eb6b..bed469c03dd 100644
bc092b
--- a/tests/grub_cmd_tr.in
bc092b
+++ b/tests/grub_cmd_tr.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh -e
bc092b
+#! @BUILD_SHEBANG@ -e
bc092b
 
bc092b
 # Run GRUB script in a Qemu instance
bc092b
 # Copyright (C) 2010  Free Software Foundation, Inc.
bc092b
diff --git a/tests/grub_func_test.in b/tests/grub_func_test.in
ec4acb
index b32f2446659..c67f9e42253 100644
bc092b
--- a/tests/grub_func_test.in
bc092b
+++ b/tests/grub_func_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 . "@builddir@/grub-core/modinfo.sh"
bc092b
diff --git a/tests/grub_script_blanklines.in b/tests/grub_script_blanklines.in
ec4acb
index 89ed763d3f4..bd8735491be 100644
bc092b
--- a/tests/grub_script_blanklines.in
bc092b
+++ b/tests/grub_script_blanklines.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 @builddir@/grub-script-check <
bc092b
diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in
ec4acb
index 63b60a2ea06..6ea9b8c3d87 100644
bc092b
--- a/tests/grub_script_blockarg.in
bc092b
+++ b/tests/grub_script_blockarg.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 
bc092b
 # Run GRUB script in a Qemu instance
bc092b
 # Copyright (C) 2010  Free Software Foundation, Inc.
bc092b
diff --git a/tests/grub_script_dollar.in b/tests/grub_script_dollar.in
ec4acb
index 2e076427afb..392fe2e7ab0 100644
bc092b
--- a/tests/grub_script_dollar.in
bc092b
+++ b/tests/grub_script_dollar.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 @builddir@/grub-script-check << EOF
bc092b
diff --git a/tests/grub_script_expansion.in b/tests/grub_script_expansion.in
ec4acb
index 2b782956838..9d0dcdd2910 100644
bc092b
--- a/tests/grub_script_expansion.in
bc092b
+++ b/tests/grub_script_expansion.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Run GRUB script in a Qemu instance
bc092b
diff --git a/tests/grub_script_final_semicolon.in b/tests/grub_script_final_semicolon.in
ec4acb
index 3ac26540bbd..f17a9bf95e6 100644
bc092b
--- a/tests/grub_script_final_semicolon.in
bc092b
+++ b/tests/grub_script_final_semicolon.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 @builddir@/grub-script-check <
bc092b
diff --git a/tests/grub_script_no_commands.in b/tests/grub_script_no_commands.in
ec4acb
index c31d267e5fd..996bb181043 100644
bc092b
--- a/tests/grub_script_no_commands.in
bc092b
+++ b/tests/grub_script_no_commands.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # grub-script-check refuses to pass a file with no commands; this usually
bc092b
diff --git a/tests/gzcompress_test.in b/tests/gzcompress_test.in
ec4acb
index 11b6bb20830..42c8fe7c4e8 100644
bc092b
--- a/tests/gzcompress_test.in
bc092b
+++ b/tests/gzcompress_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/hddboot_test.in b/tests/hddboot_test.in
ec4acb
index c229716a642..6d70847a5de 100644
bc092b
--- a/tests/hddboot_test.in
bc092b
+++ b/tests/hddboot_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/help_test.in b/tests/help_test.in
ec4acb
index aa96458355b..b08cf201382 100644
bc092b
--- a/tests/help_test.in
bc092b
+++ b/tests/help_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 . "@builddir@/grub-core/modinfo.sh"
bc092b
diff --git a/tests/hfs_test.in b/tests/hfs_test.in
ec4acb
index e3e88f19067..d7ec56beffa 100644
bc092b
--- a/tests/hfs_test.in
bc092b
+++ b/tests/hfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/hfsplus_test.in b/tests/hfsplus_test.in
ec4acb
index f947c4a447f..85f1c37dce6 100644
bc092b
--- a/tests/hfsplus_test.in
bc092b
+++ b/tests/hfsplus_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/iso9660_test.in b/tests/iso9660_test.in
ec4acb
index fdcc9e12420..571b938d7a0 100644
bc092b
--- a/tests/iso9660_test.in
bc092b
+++ b/tests/iso9660_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/jfs_test.in b/tests/jfs_test.in
ec4acb
index c2e5eceddcd..6cf7576b35e 100644
bc092b
--- a/tests/jfs_test.in
bc092b
+++ b/tests/jfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/lzocompress_test.in b/tests/lzocompress_test.in
ec4acb
index 41984c25419..4e5f7e078d5 100644
bc092b
--- a/tests/lzocompress_test.in
bc092b
+++ b/tests/lzocompress_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/minixfs_test.in b/tests/minixfs_test.in
ec4acb
index 1784b1261f7..3b16a4de093 100644
bc092b
--- a/tests/minixfs_test.in
bc092b
+++ b/tests/minixfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/netboot_test.in b/tests/netboot_test.in
ec4acb
index c757023d989..9f71e3d8854 100644
bc092b
--- a/tests/netboot_test.in
bc092b
+++ b/tests/netboot_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/nilfs2_test.in b/tests/nilfs2_test.in
ec4acb
index 780b60ec1ac..ad44d5b33c8 100644
bc092b
--- a/tests/nilfs2_test.in
bc092b
+++ b/tests/nilfs2_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/ntfs_test.in b/tests/ntfs_test.in
ec4acb
index e25c6384a9c..9eb7b01f66e 100644
bc092b
--- a/tests/ntfs_test.in
bc092b
+++ b/tests/ntfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/ohci_test.in b/tests/ohci_test.in
ec4acb
index 7fede6f262c..8693f8c4728 100644
bc092b
--- a/tests/ohci_test.in
bc092b
+++ b/tests/ohci_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/partmap_test.in b/tests/partmap_test.in
ec4acb
index f8dc456fb8c..6ef518b0adc 100644
bc092b
--- a/tests/partmap_test.in
bc092b
+++ b/tests/partmap_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Copyright (C) 2010  Free Software Foundation, Inc.
bc092b
diff --git a/tests/pata_test.in b/tests/pata_test.in
ec4acb
index c1d0f63ea21..4b18fdef3d3 100644
bc092b
--- a/tests/pata_test.in
bc092b
+++ b/tests/pata_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/pseries_test.in b/tests/pseries_test.in
ec4acb
index 226494593d1..655eb4f3a63 100644
bc092b
--- a/tests/pseries_test.in
bc092b
+++ b/tests/pseries_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/reiserfs_test.in b/tests/reiserfs_test.in
ec4acb
index 678efe7b366..b5fed763567 100644
bc092b
--- a/tests/reiserfs_test.in
bc092b
+++ b/tests/reiserfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/romfs_test.in b/tests/romfs_test.in
ec4acb
index 83e09315acf..98bb50c324b 100644
bc092b
--- a/tests/romfs_test.in
bc092b
+++ b/tests/romfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/squashfs_test.in b/tests/squashfs_test.in
ec4acb
index ec34e0108c3..2f044f95d99 100644
bc092b
--- a/tests/squashfs_test.in
bc092b
+++ b/tests/squashfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in
ec4acb
index fc4edd8ef6b..4ea86390e0a 100644
bc092b
--- a/tests/syslinux_test.in
bc092b
+++ b/tests/syslinux_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/tar_test.in b/tests/tar_test.in
ec4acb
index 46ba3bce295..6e2f2de8b7f 100644
bc092b
--- a/tests/tar_test.in
bc092b
+++ b/tests/tar_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/test_sha512sum.in b/tests/test_sha512sum.in
ec4acb
index 80ebdc59fd5..027092a8b17 100644
bc092b
--- a/tests/test_sha512sum.in
bc092b
+++ b/tests/test_sha512sum.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 
bc092b
 # create a randome file
bc092b
 file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
bc092b
diff --git a/tests/udf_test.in b/tests/udf_test.in
ec4acb
index fe244e2bdfc..fb92f0173cc 100644
bc092b
--- a/tests/udf_test.in
bc092b
+++ b/tests/udf_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/uhci_test.in b/tests/uhci_test.in
ec4acb
index 89e2c18051a..4af72fd8fea 100644
bc092b
--- a/tests/uhci_test.in
bc092b
+++ b/tests/uhci_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in
ec4acb
index 468d9e7856d..88cbe7365e9 100644
bc092b
--- a/tests/util/grub-fs-tester.in
bc092b
+++ b/tests/util/grub-fs-tester.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
ec4acb
index 5adce0a47fe..8a87109b152 100644
bc092b
--- a/tests/util/grub-shell-tester.in
bc092b
+++ b/tests/util/grub-shell-tester.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Compares GRUB script output with BASH output.
bc092b
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
ec4acb
index 814f36c6bd2..d690d6734ef 100644
bc092b
--- a/tests/util/grub-shell.in
bc092b
+++ b/tests/util/grub-shell.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 set -e
bc092b
 
bc092b
 # Run GRUB script in a Qemu instance
bc092b
diff --git a/tests/xfs_test.in b/tests/xfs_test.in
ec4acb
index 3807e2e5c77..03a3513595d 100644
bc092b
--- a/tests/xfs_test.in
bc092b
+++ b/tests/xfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b
 
bc092b
diff --git a/tests/xzcompress_test.in b/tests/xzcompress_test.in
ec4acb
index b2bd999ec07..03bfb5e951d 100644
bc092b
--- a/tests/xzcompress_test.in
bc092b
+++ b/tests/xzcompress_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#! /bin/sh
bc092b
+#! @BUILD_SHEBANG@
bc092b
 # Copyright (C) 2013  Free Software Foundation, Inc.
bc092b
 #
bc092b
 # GRUB is free software: you can redistribute it and/or modify
bc092b
diff --git a/tests/zfs_test.in b/tests/zfs_test.in
ec4acb
index 047120e47a0..eee62c10d70 100644
bc092b
--- a/tests/zfs_test.in
bc092b
+++ b/tests/zfs_test.in
bc092b
@@ -1,4 +1,4 @@
bc092b
-#!/bin/sh
bc092b
+#!@BUILD_SHEBANG@
bc092b
 
bc092b
 set -e
bc092b