[PATCH 08/15] scripts: link-barebox: fix bash-ism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on linux v4.1 patch: ab160dbbc4ba71a4e339382d37b31ea44fd43e86

    scripts: fix link-vmlinux.sh bash-ism

    While building linux with dash shell:
      LINK    vmlinux
    trap: SIGHUP: bad trap
    /src/linux-4.0/Makefile:933: recipe for target 'vmlinux' failed
    make[1]: *** [vmlinux] Error 1

    See the following document for behavior of posix shell trap instruction:
    http://pubs.opengroup.org/onlinepubs/000095399/utilities/trap.html

    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@xxxxxxxxx>
    Signed-off-by: Michal Marek <mmarek@xxxxxxx>

Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
 scripts/link-barebox.sh | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/scripts/link-barebox.sh b/scripts/link-barebox.sh
index 2d920bc44b8e..bff2363a19d5 100755
--- a/scripts/link-barebox.sh
+++ b/scripts/link-barebox.sh
@@ -107,7 +107,6 @@ mksysmap()
 }
 
 # Delete output files in case of error
-trap cleanup SIGHUP SIGINT SIGQUIT SIGTERM ERR
 cleanup()
 {
 	rm -f include/generated/barebox_default_env.h
@@ -122,6 +121,20 @@ cleanup()
 	rm -f barebox
 }
 
+on_exit()
+{
+	if [ $? -ne 0 ]; then
+		cleanup
+	fi
+}
+trap on_exit EXIT
+
+on_signals()
+{
+	exit 1
+}
+trap on_signals HUP INT QUIT TERM
+
 #
 #
 # Use "make V=1" to debug this script
-- 
2.19.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux