]> the.earth.li Git - mqttdeck.git/commitdiff
Add basic, terrible, Debian packaging
authorJonathan McDowell <noodles@earth.li>
Sat, 10 Jun 2023 16:39:22 +0000 (17:39 +0100)
committerJonathan McDowell <noodles@earth.li>
Sat, 10 Jun 2023 17:16:49 +0000 (18:16 +0100)
This is not the right way to package a Rust binary for Debian; it makes
no attempt to use system Rust crates and instead invokes cargo itself to
download what's needed. However it makes it much easier to test
deployment and in the unlikely event I decide to upload to Debian I'll
fix it to use dh-cargo etc first.

debian/changelog [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/postinst [new file with mode: 0644]
debian/postrm [new file with mode: 0644]
debian/rules [new file with mode: 0755]

diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..823e9a3
--- /dev/null
@@ -0,0 +1,5 @@
+mqttdeck (0.1.0-1) unstable; urgency=low
+
+  * Initial release
+
+ -- Jonathan McDowell <noodles@earth.li>  Fri, 09 Jun 2023 19:33:55 +0100
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..adbbd13
--- /dev/null
@@ -0,0 +1,16 @@
+Source: mqttdeck
+Section: utils
+Priority: optional
+Maintainer: Jonathan McDowell <noodles@earth.li>
+Standards-Version: 4.6.2
+Rules-Requires-Root: no
+Build-Depends: cargo,
+       debhelper-compat (= 13),
+       rustc
+
+Package: mqttdeck
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Description: Stream Deck to MQTT bridge
+ mqttdeck bridges an Elgato Stream Deck to MQTT, sending events when buttons
+ are pressed, and allowing control of the button images via MQTT.
diff --git a/debian/postinst b/debian/postinst
new file mode 100644 (file)
index 0000000..02b0a7f
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+set -e
+
+if [ "$1" = "configure" ]; then
+       if ! getent passwd | grep -q "^mqttdeck:"; then
+               echo "Adding system user mqttdeck..."
+               adduser --system --disabled-login mqttdeck
+       fi
+
+       # Ensure the config file is owned by us
+       dpkg-statoverride --update --add mqttdeck root 0660 /etc/mqttdeck.ini
+fi
+
+#DEBHELPER#
diff --git a/debian/postrm b/debian/postrm
new file mode 100644 (file)
index 0000000..a38e099
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+set -e
+
+if [ "$1" = "purge" ]; then
+       deluser --system mqttdeck
+fi
+
+#DEBHELPER#
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..1c53b50
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+
+%:
+       dh "$@"
+
+override_dh_auto_build:
+       cargo build --release
+
+override_dh_auto_install:
+       mkdir -p debian/mqttdeck/usr/sbin
+       mkdir -p debian/mqttdeck/etc
+       cp target/release/mqttdeck debian/mqttdeck/usr/sbin
+       cp mqttdeck.ini debian/mqttdeck/etc