maint: add shebang

This commit adds a test called `shebang`, which checks if all shebangs
in scripts use relative paths through `#/usr/bin/env`, rather than
absolute paths, such as `#/bin/bash`.

See 833b10575b.
This commit is contained in:
Emil Engler 2023-01-26 21:04:34 +01:00
parent 59e812bdbe
commit 53bf3492e8
No known key found for this signature in database
GPG Key ID: 2F6D4145C55FC7C7
1 changed files with 10 additions and 0 deletions

10
maint/shebang Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if git grep -rnI "^#\!/" :/ | grep -v "#\!/usr/bin/env"
then
echo "Absolute shebangs found, replace them with \"#!/usr/bin/env\""
exit 1
else
echo "Everything seems ok"
exit 0
fi