]> WPIA git - gigi.git/commitdiff
add: mkosi files
authorLucas Werkmeister <mail@lucaswerkmeister.de>
Mon, 26 Feb 2018 01:02:35 +0000 (02:02 +0100)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Sat, 9 Jun 2018 11:10:10 +0000 (13:10 +0200)
mkosi is a tool to build operating system images, possibly with some
software pre-built inside it. This commit adds mkosi configuration files
for building the Debian packages for Gigi on any distribution supported
by mkosi. The *.deb files will be placed in the srv/ directory of the
resulting image (image/srv/*.deb).

Note that mkosi doesn’t include git information in the build tree, so
the changelog used for the packages is whatever is currently in the
source tree. Consider running doc/scripts/genchangelog before mkosi.

The packages are also, unfortunately, not yet deterministic. The
strip-nondeterminism debhelper step uses the date from the changelog (so
if doc/scripts/genchangelog was run before the build started, that part
is deterministic), but it only seems to adjust the timestamps of the
three files in the .deb archives, not of the files within those .tar.*
archives.

A post-install script is included that could potentially be used to
actually install the packages inside the built image. However, that part
doesn’t yet work, so it’s disabled for now: the post-install scripts of
the packages have some extra requirements (more packages, an internet
connection) which mkosi doesn’t satisfy by default, and I didn’t want to
spend more time to find out if it can be made to work. This might be
fixed in a future commit, but even then, it’s not clear if such an image
would be very useful.

Change-Id: Ib966760b31f75cf0e8892428b6a8c6dba5ec5f2e

mkosi.build [new file with mode: 0755]
mkosi.default [new file with mode: 0644]
mkosi.postinst [new file with mode: 0755]

diff --git a/mkosi.build b/mkosi.build
new file mode 100755 (executable)
index 0000000..60307a1
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+set -e
+
+cd -- "$SRCDIR"
+
+# doc/scripts/genchangelog # mkosi doesn’t copy .git
+
+dpkg-buildpackage -b -us -uc
+
+mkdir -- "$DESTDIR/srv/"
+cp -v ../*.deb -- "$DESTDIR/srv/"
diff --git a/mkosi.default b/mkosi.default
new file mode 100644 (file)
index 0000000..41d849a
--- /dev/null
@@ -0,0 +1,11 @@
+[Distribution]
+Distribution=debian
+Release=stretch
+
+[Output]
+Format=directory
+
+[Packages]
+Packages=default-jre-headless libpostgresql-jdbc-java libdnsjava-java debconf init-system-helpers
+BuildPackages=debhelper dh-systemd default-jdk-headless build-essential ant wget
+Cache=/var/cache/apt/archives
diff --git a/mkosi.postinst b/mkosi.postinst
new file mode 100755 (executable)
index 0000000..c7548ec
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ "$1" = "final" ]; then
+    # disabled for now; the postinst scripts can’t run in the built image
+    #dpkg --install /*.deb
+    : # `if` bodies can’t be empty
+fi