aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-12-24 20:24:05 -0300
committerEuAndreh <eu@euandre.org>2020-12-24 20:31:46 -0300
commit15c4774f17f67eb69a0162390b77201e7817fe94 (patch)
tree3adf4a6a62dd9fea579dd9bbcbf6cacc03c1bf98
parentUse MKV over webm (diff)
downloadeuandre.org-15c4774f17f67eb69a0162390b77201e7817fe94.tar.gz
euandre.org-15c4774f17f67eb69a0162390b77201e7817fe94.tar.xz
Use /bin/sh over Bash
-rwxr-xr-xscripts/assert-nixfmt.sh20
-rwxr-xr-xscripts/assert-shellcheck.sh9
-rwxr-xr-xscripts/assert-todos.sh9
-rwxr-xr-xscripts/bundix-gen.sh3
-rwxr-xr-xscripts/sync-translations.sh7
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