]> git.ipfire.org Git - thirdparty/systemd.git/blame - tools/find-build-dir.sh
core: skip unit deserialization and move to the next one when unit_deserialize()...
[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
8 echo "$(realpath "$BUILD_DIR")"
9 exit 0
10fi
11
12root="$(dirname "$(realpath "$0")")"
13
14found=
15for i in "$root"/../*/build.ninja; do
16 c="$(dirname $i)"
17 [ -d "$c" ] || continue
18 [ "$(basename "$c")" != mkosi.builddir ] || continue
19
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"
25done
26
27if [ -z "$found" ]; then
28 echo 'Specify build directory with $BUILD_DIR' >&2
29 exit 1
30fi
31
32echo "$(realpath $found)"