summaryrefslogtreecommitdiff
path: root/tools/find-build-dir.sh
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2021-04-20 13:02:02 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2021-04-20 20:11:13 +0200
commit3b6fd3c1dea070cb1882b8810e18a45158a356f2 (patch)
tree1a42abd78e9acf4cf528c6e0e8998652c87ede9d /tools/find-build-dir.sh
parent437e889b18743ea4d594521829e43b6067ce9036 (diff)
downloadsystemd-3b6fd3c1dea070cb1882b8810e18a45158a356f2.tar.gz
tools: shellcheck-ify most of the tool scripts
Diffstat (limited to 'tools/find-build-dir.sh')
-rwxr-xr-xtools/find-build-dir.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/find-build-dir.sh b/tools/find-build-dir.sh
index e449b6e865..79a79fcc58 100755
--- a/tools/find-build-dir.sh
+++ b/tools/find-build-dir.sh
@@ -1,12 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later
-set -e
+set -eu
# Try to guess the build directory:
# we look for subdirectories of the parent directory that look like ninja build dirs.
-if [ -n "$BUILD_DIR" ]; then
- echo "$(realpath "$BUILD_DIR")"
+if [ -n "${BUILD_DIR:=}" ]; then
+ realpath "$BUILD_DIR"
exit 0
fi
@@ -14,20 +14,20 @@ root="$(dirname "$(realpath "$0")")"
found=
for i in "$root"/../*/build.ninja; do
- c="$(dirname $i)"
+ c="$(dirname "$i")"
[ -d "$c" ] || continue
[ "$(basename "$c")" != mkosi.builddir ] || continue
if [ -n "$found" ]; then
- echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
+ echo "Found multiple candidates, specify build directory with \$BUILD_DIR" >&2
exit 2
fi
found="$c"
done
if [ -z "$found" ]; then
- echo 'Specify build directory with $BUILD_DIR' >&2
+ echo "Specify build directory with \$BUILD_DIR" >&2
exit 1
fi
-echo "$(realpath $found)"
+realpath "$found"