summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-25 22:59:54 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-29 17:35:21 -0400
commit1859296186d22cae6eceb1acbd9d3e347d2e76db (patch)
treeaeca22dabaabdb82c014038e82549ab30ca20522 /tools
parentc85201406bf351298832f136b2a89a1bf5b17202 (diff)
Package `hi` for Debian.
This commit provides a Docker-based build process for generating `.deb` packages, which can be run in Docker Desktop. I don't love it, but it's the best option I have _right now_ for doing this. The resulting packages: * Install `hi` (and `hi-recanonicalize`), in `/usr/bin`. * Create a user (`hi`) and a data directory (`/var/lib/hi`). * Create and start a systemd service unit for `hi`. Packages are built for arm64 and amd64 (aka x86_64).
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build-builder14
-rwxr-xr-xtools/build-debian20
-rwxr-xr-xtools/version11
3 files changed, 45 insertions, 0 deletions
diff --git a/tools/build-builder b/tools/build-builder
new file mode 100755
index 0000000..fcb1e84
--- /dev/null
+++ b/tools/build-builder
@@ -0,0 +1,14 @@
+#!/bin/bash -e
+
+## tools/build-builder
+##
+## Builds a Docker image containing the Debian package builder.
+
+cd "$(dirname "$0")/.."
+
+docker build \
+ --platform "linux/arm64,linux/amd64" \
+ --tag "hi-debian-builder:$(tools/version)" \
+ --tag "hi-debian-builder:latest" \
+ --file Dockerfile.builder \
+ .
diff --git a/tools/build-debian b/tools/build-debian
new file mode 100755
index 0000000..c64fc78
--- /dev/null
+++ b/tools/build-debian
@@ -0,0 +1,20 @@
+#!/bin/bash -e
+
+## tools/build-builder
+##
+## Builds a Debian package for the current tree. Output in ./target/debian.
+##
+## Requires the Debian builder (see tools/build-builder).
+
+cd "$(dirname "$0")/.."
+
+for platform in linux/arm64 linux/amd64; do
+ docker run \
+ --platform "$platform" \
+ --rm \
+ --interactive \
+ --tty \
+ --volume "$PWD:/app" \
+ "hi-debian-builder:$(tools/version)" \
+ cargo deb
+done
diff --git a/tools/version b/tools/version
new file mode 100755
index 0000000..8e47a7c
--- /dev/null
+++ b/tools/version
@@ -0,0 +1,11 @@
+#!/bin/bash -e
+
+## tools/version
+##
+## Print the current version of the project to stdout. Data comes from Cargo.
+
+cd "$(dirname "$0")/.."
+
+cargo metadata \
+ --format-version 1 |
+jq -r '.packages[] | select(.name == "hi") | .version'