From 15c4774f17f67eb69a0162390b77201e7817fe94 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 24 Dec 2020 20:24:05 -0300 Subject: Use /bin/sh over Bash --- scripts/assert-nixfmt.sh | 20 ++++++-------------- scripts/assert-shellcheck.sh | 9 ++++----- scripts/assert-todos.sh | 9 ++------- scripts/bundix-gen.sh | 3 +-- scripts/sync-translations.sh | 7 +------ 5 files changed, 14 insertions(+), 34 deletions(-) diff --git a/scripts/assert-nixfmt.sh b/scripts/assert-nixfmt.sh index 7a68fa9..761c1e2 100755 --- a/scripts/assert-nixfmt.sh +++ b/scripts/assert-nixfmt.sh @@ -1,16 +1,8 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" -cd ../ +#!/bin/sh -eux -format() { - nix_file="${1}" - diff <(nixfmt < "${nix_file}") "${nix_file}" || { - echo "The file '${nix_file}' is unformatted. To fix it, run:" - echo " nixfmt ${nix_file}" - exit 1 - } +# shellcheck disable=2094 +nixfmt < default.nix | diff - default.nix || { + echo 'The file default.nix is unformatted. To fix it, run:' + echo ' nixfmt default.nix' + exit 1 } -export -f format - -find . -type f -name '*.nix' -print0 | xargs -0 -I% bash -c "format %" diff --git a/scripts/assert-shellcheck.sh b/scripts/assert-shellcheck.sh index e24c29c..d07815b 100755 --- a/scripts/assert-shellcheck.sh +++ b/scripts/assert-shellcheck.sh @@ -1,6 +1,5 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" -cd ../ +#!/bin/sh -eux -git ls-files | grep '\.sh$' | xargs shellcheck +git ls-files -z | \ + xargs -0 awk 'FNR==1 && /^#!\/bin\/sh/ { print FILENAME }' | \ + xargs shellcheck diff --git a/scripts/assert-todos.sh b/scripts/assert-todos.sh index 14a1b71..df7a96d 100755 --- a/scripts/assert-todos.sh +++ b/scripts/assert-todos.sh @@ -1,11 +1,6 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" -cd ../ +#!/bin/sh -eux -# shellcheck disable=2046 -if grep -R FIXME $(git ls-files) | \ - grep -Ev '^(vendor/|.git/|scripts/assert-todos.sh|locale/)'; then +if git grep FIXME | grep -Ev '^(vendor/|.git/|scripts/assert-todos.sh|locale/)'; then echo "Found dangling FIXME markers on the project." echo "You should write them down properly on TODOs.org." exit 1 diff --git a/scripts/bundix-gen.sh b/scripts/bundix-gen.sh index d3cf80c..6d5032f 100755 --- a/scripts/bundix-gen.sh +++ b/scripts/bundix-gen.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash -set -Eeuo pipefail +#!/bin/sh -eux bundler package --no-install --path vendor bundix diff --git a/scripts/sync-translations.sh b/scripts/sync-translations.sh index 4becea6..1e86340 100755 --- a/scripts/sync-translations.sh +++ b/scripts/sync-translations.sh @@ -1,9 +1,4 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" -cd ../ - -set -x +#!/bin/sh -eux ./scripts/extract-translations.sh ./scripts/apply-translations.sh -- cgit v1.2.3