Framework: add lint pass to check for missing shebang

PR: https://forum.opnsense.org/index.php?topic=15827.0
This commit is contained in:
Franco Fichtner 2020-02-12 15:56:53 +01:00
parent d3ce811139
commit 40448f8b62

View file

@ -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 \