commit e866e08f8a609603b23fb4347e6d1549eeb6eb31 parent d294eb5fd63dba16487fbb20d8603d97cbe78691 Author: amin <dev@aminmesbah.com> Date: Fri, 12 Aug 2022 06:00:37 +0000 Add arch package and systemd service FossilOrigin-Name: e90ad8ff9795ebe10b91165fd2700d9e8870046c8ac7f2f522f812d53a21462f Diffstat:
A | PKGBUILD | | | 32 | ++++++++++++++++++++++++++++++++ |
A | co2minimon.service | | | 9 | +++++++++ |
M | main.c | | | 1 | - |
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/PKGBUILD b/PKGBUILD @@ -0,0 +1,32 @@ +# Maintainer: Amin Mesbah <dev@aminmesbah.com> + +# https://wiki.archlinux.org/title/PKGBUILD + +pkgname=co2minimon +pkgver=0.0.1 +pkgrel=1 +pkgdesc='Daemon for CO2Mini sensor.' +arch=('any') +license=('Unlicense') +makedepends=('bash' 'clang') +provides=('co2minimon') +source=(build.sh + main.c + LICENSE + ${pkgname}.service) +# update with updpkgsums from pacman-contrib +sha256sums=('760c19a24dce4341650857d28f3f6e6f7fe788428c9658ff9082d01c6afaec72' + '68532958d2b33a063ce0c61901f5e9515cbee830838bcde2ff143c23c2aadc08' + '7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c' + '2d6b333afdf16af84232032040703c054b5529a79d4bea4e65831fd50b05635a') + + +build() { + /usr/bin/env bash build.sh || exit 1 +} + +package() { + install -D --mode=644 ${pkgname}.service "${pkgdir}/usr/lib/systemd/user/${pkgname}.service" || exit 1 + install -D --mode=755 out/release/co2minimon "${pkgdir}/usr/bin/co2minimon" || exit 1 + install -D --mode=644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" || exit 1 +} diff --git a/co2minimon.service b/co2minimon.service @@ -0,0 +1,9 @@ +[Unit] +Description=CO2Mini Monitor Daemon + +[Service] +Type=simple +ExecStart=/usr/bin/co2minimon + +[Install] +WantedBy=default.target diff --git a/main.c b/main.c @@ -12,7 +12,6 @@ #include <unistd.h> // TODO: Use syslog.h for logging -// TODO: Make a systemd unit for this // https://www.kernel.org/doc/Documentation/hid/hidraw.txt #include <linux/hidraw.h>