From 40448f8b627f43256b4bde2e29bee9ac577812e0 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 12 Feb 2020 15:56:53 +0100 Subject: [PATCH] Framework: add lint pass to check for missing shebang PR: https://forum.opnsense.org/index.php?topic=15827.0 --- Mk/plugins.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Mk/plugins.mk b/Mk/plugins.mk index 89b97d398..a4e41143e 100644 --- a/Mk/plugins.mk +++ b/Mk/plugins.mk @@ -272,8 +272,12 @@ lint-desc: check fi lint-shell: - @find ${.CURDIR}/src \ - -name "*.sh" -type f -print0 | xargs -0 -n1 sh -n + @for FILE in $$(find ${.CURDIR}/src -name "*.sh" -type f); do \ + if [ "$$(head $${FILE} | grep -c '^#!\/bin\/sh$$')" == "0" ]; then \ + echo "Missing shebang in $${FILE}"; exit 1; \ + fi; \ + sh -n $${FILE}; \ + done lint-xml: @find ${.CURDIR}/src \