2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-08-16 19:27:31 +02:00
|
|
|
# Copyright (c) 2018-2019 The Bitcoin Core developers
|
2020-01-16 21:57:24 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-12-06 15:45:48 +01:00
|
|
|
# Assert expected shebang lines
|
2018-06-18 13:12:07 +02:00
|
|
|
|
|
|
|
export LC_ALL=C
|
2018-04-16 22:03:08 +02:00
|
|
|
EXIT_CODE=0
|
2022-11-15 16:38:57 +01:00
|
|
|
for PYTHON_FILE in $(git ls-files -- "*.py" | grep -vE "^src/(dashbls|immer)/"); do
|
2018-04-16 22:03:08 +02:00
|
|
|
if [[ $(head -c 2 "${PYTHON_FILE}") == "#!" &&
|
|
|
|
$(head -n 1 "${PYTHON_FILE}") != "#!/usr/bin/env python3" ]]; then
|
|
|
|
echo "Missing shebang \"#!/usr/bin/env python3\" in ${PYTHON_FILE} (do not use python or python2)"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
done
|
2022-11-15 16:38:57 +01:00
|
|
|
for SHELL_FILE in $(git ls-files -- "*.sh" | grep -vE "^src/(dashbls|immer)/"); do
|
2018-12-06 15:45:48 +01:00
|
|
|
if [[ $(head -n 1 "${SHELL_FILE}") != "#!/usr/bin/env bash" &&
|
|
|
|
$(head -n 1 "${SHELL_FILE}") != "#!/bin/sh" ]]; then
|
|
|
|
echo "Missing expected shebang \"#!/usr/bin/env bash\" or \"#!/bin/sh\" in ${SHELL_FILE}"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
done
|
2018-04-16 22:03:08 +02:00
|
|
|
exit ${EXIT_CODE}
|