summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xmkosi.build16
2 files changed, 12 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index cd289d6538..aa20b80602 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,8 @@
/localectl
/loginctl
/machinectl
+/mkosi.builddir/
+/mkosi.cache/
/mtd_probe
/networkctl
/scsi_id
diff --git a/mkosi.build b/mkosi.build
index 2231118da5..a36460c6f5 100755
--- a/mkosi.build
+++ b/mkosi.build
@@ -20,15 +20,19 @@
# This is a build script for OS image generation using mkosi (https://github.com/systemd/mkosi).
# Simply invoke "mkosi" in the project directory to build an OS image.
+# If mkosi.builddir/ exists mkosi will set $BUILDDIR to it, let's then use it
+# as out-of-tree build dir. Otherwise, let's make up our own builddir.
+[ -z "$BUILDDIR" ] && BUILDDIR=build
+
export LC_CTYPE=C.UTF-8
-meson build
-ninja -C build all
-ninja -C build test
-ninja -C build install
+test -f "$BUILDDIR"/build.ninja || meson "$BUILDDIR"
+ninja -C "$BUILDDIR" all
+ninja -C "$BUILDDIR" test
+ninja -C "$BUILDDIR" install
-mkdir -p $DESTDIR/etc
+mkdir -p "$DESTDIR"/etc
-cat > $DESTDIR/etc/issue <<EOF
+cat > "$DESTDIR"/etc/issue <<EOF
\S (built from systemd tree)
Kernel \r on an \m (\l)