From 9c298de9c491e801d6bd5180e929b902b340a2b9 Mon Sep 17 00:00:00 2001 From: AJ Jordan Date: Thu, 10 Oct 2024 02:22:13 -0400 Subject: [PATCH] Check for `set -euo pipefail` --- lint.sh | 5 +++++ sbin/seagl-reset-users | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lint.sh b/lint.sh index d1b9016..f1d93b8 100755 --- a/lint.sh +++ b/lint.sh @@ -8,3 +8,8 @@ trap 'echo Failed!' ERR echo 'Checking that all `flatpak` invocations pass `--system`.' # We use () to make this a subshell to avoid ! not triggering a `set -e` bailout; see bash(1)'s documentation on this flag for more ( ! grep -n flatpak *.sh | grep -v -- --system ) + +for i in bin/* sbin/*; do + echo 'Checking that `'"$i"'` contains `set -euo pipefail`.' + grep -q 'set -euo pipefail' $i +done diff --git a/sbin/seagl-reset-users b/sbin/seagl-reset-users index ab9547b..fc075d4 100755 --- a/sbin/seagl-reset-users +++ b/sbin/seagl-reset-users @@ -1,5 +1,7 @@ #!/bin/bash +set -euo pipefail + if ! [ $(id -u) == 0 ]; then echo must be run as root 1>&2 exit 1