]> git.ipfire.org Git - thirdparty/systemd.git/blame - tools/find-build-dir.sh
test-network: use wait-online in NetworkdBondTests
[thirdparty/systemd.git] / tools / find-build-dir.sh
CommitLineData
7629744a 1#!/bin/sh
2set -e
ded65775
ZJS
3
4# Try to guess the build directory:
5# we look for subdirectories of the parent directory that look like ninja build dirs.
6
7if [ -n "$BUILD_DIR" ]; then
cc5549ca
ZJS
8 echo "$(realpath "$BUILD_DIR")"
9 exit 0
ded65775
ZJS
10fi
11
12root="$(dirname "$(realpath "$0")")"
13
14found=
15for i in "$root"/../*/build.ninja; do
cc5549ca
ZJS
16 c="$(dirname $i)"
17 [ -d "$c" ] || continue
18 [ "$(basename "$c")" != mkosi.builddir ] || continue
ded65775 19
cc5549ca
ZJS
20 if [ -n "$found" ]; then
21 echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
22 exit 2
23 fi
24 found="$c"
ded65775
ZJS
25done
26
27if [ -z "$found" ]; then
cc5549ca
ZJS
28 echo 'Specify build directory with $BUILD_DIR' >&2
29 exit 1
ded65775
ZJS
30fi
31
32echo "$(realpath $found)"