kheaders: remove the last bashism to allow sh to run it
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 8 Oct 2019 12:05:55 +0000 (21:05 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 11 Nov 2019 11:10:01 +0000 (20:10 +0900)
'pushd' ... 'popd' is the last bash-specific code in this script.
One way to avoid it is to run the code in a sub-shell.

With that addressed, you can run this script with sh.

I replaced $(BASH) with $(CONFIG_SHELL), and I changed the hashbang
to #!/bin/sh.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
kernel/Makefile
kernel/gen_kheaders.sh

index daad787..42557f2 100644 (file)
@@ -128,7 +128,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
 $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
 
 quiet_cmd_genikh = CHK     $(obj)/kheaders_data.tar.xz
-      cmd_genikh = $(BASH) $(srctree)/kernel/gen_kheaders.sh $@
+      cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@
 $(obj)/kheaders_data.tar.xz: FORCE
        $(call cmd,genikh)
 
index 0f7752d..dc5744b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
 # This script generates an archive consisting of kernel headers
@@ -57,11 +57,12 @@ rm -rf $cpio_dir
 mkdir $cpio_dir
 
 if [ "$building_out_of_srctree" ]; then
-       pushd $srctree > /dev/null
-       for f in $dir_list
-               do find "$f" -name "*.h";
-       done | cpio --quiet -pd $cpio_dir
-       popd > /dev/null
+       (
+               cd $srctree
+               for f in $dir_list
+                       do find "$f" -name "*.h";
+               done | cpio --quiet -pd $cpio_dir
+       )
 fi
 
 # The second CPIO can complain if files already exist which can happen with out