diff options
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | 99-co2mon.rules | 2 | ||||
-rw-r--r-- | PKGBUILD | 46 | ||||
-rw-r--r-- | co2mon-git.install | 14 | ||||
-rw-r--r-- | co2mon-git.tmpfiles.conf | 1 | ||||
-rw-r--r-- | co2mon.service | 7 |
6 files changed, 94 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..f741d75a39ea --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,24 @@ +pkgbase = co2mon-git + pkgdesc = CLI for MasterKit CO2 Monitor + pkgver = 2.0.1.r9.gdf58994 + pkgrel = 1 + url = https://github.com/dmage/co2mon + install = co2mon-git.install + arch = i686 + arch = x86_64 + makedepends = git + makedepends = cmake + depends = hidapi + optdepends = munin-node: for monitoring sensor values via munin + conflicts = co2mon + source = git+https://github.com/dmage/co2mon.git + source = 99-co2mon.rules + source = co2mon.service + source = co2mon-git.tmpfiles.conf + md5sums = SKIP + md5sums = 34aa92981e6a150fc75c43c9427698ee + md5sums = bef542a1a14f1b5def074c8181ebac0e + md5sums = f56b35a4420383659798bfa2b31790d5 + +pkgname = co2mon-git + diff --git a/99-co2mon.rules b/99-co2mon.rules new file mode 100644 index 000000000000..c429d5a088a8 --- /dev/null +++ b/99-co2mon.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4d9/a052/*", OWNER="nobody", RUN+="/usr/bin/systemctl start co2mon.service" +SUBSYSTEM=="usb", ACTION=="remove", ENV{PRODUCT}=="4d9/a052/*", OWNER="nobody", RUN+="/usr/bin/systemctl stop co2mon.service" diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..d71f5a785c3f --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,46 @@ +#TODO: should it be named 'co2mond'? +pkgname='co2mon-git' +pkgdesc='CLI for MasterKit CO2 Monitor' +pkgver=2.0.1.r9.gdf58994 +pkgrel=1 +arch=('i686' 'x86_64') +url='https://github.com/dmage/co2mon' + +conflicts=('co2mon') +depends=('hidapi') +optdepends=('munin-node: for monitoring sensor values via munin') +makedepends=('git' 'cmake') + +install=$pkgname.install +source=('git+https://github.com/dmage/co2mon.git' + '99-co2mon.rules' + 'co2mon.service' + 'co2mon-git.tmpfiles.conf') +md5sums=('SKIP' + '34aa92981e6a150fc75c43c9427698ee' + 'bef542a1a14f1b5def074c8181ebac0e' + 'f56b35a4420383659798bfa2b31790d5') + +pkgver() { + cd "$srcdir/co2mon" + git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +build() { + mkdir -pv "$srcdir/co2mon/build" + cd "$srcdir/co2mon/build" + cmake .. + make +} + +package() { + cd "$srcdir/co2mon" || exit 1 + + install -Dvm755 -t "$pkgdir/usr/bin/" "$srcdir/co2mon/build/co2mond/co2mond" + install -Dvm644 -t "$pkgdir/usr/lib/udev/rules.d" "$srcdir/99-co2mon.rules" + install -Dvm644 -t "$pkgdir/usr/lib/systemd/system/" "$srcdir/co2mon.service" + install -Dvm644 "$srcdir/co2mon-git.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/co2mon-git.conf" + + install -Dvm755 -t "$pkgdir/usr/lib/munin/plugins" "$srcdir/co2mon/graph/munin/"* + +} diff --git a/co2mon-git.install b/co2mon-git.install new file mode 100644 index 000000000000..b6246605083e --- /dev/null +++ b/co2mon-git.install @@ -0,0 +1,14 @@ +post_install() { + post_upgrade + echo 'co2mon.service would be auto started/stopped on device [un]plugging' + echo 'When co2mon.service is running you may check sensors values in /var/lib/co2mon' + echo 'Or check journalctl -u co2monitor.service' +} + +post_upgrade() { + if type -P systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create co2mon-git.conf + fi +} + +# vim:set ts=2 sw=2 et: diff --git a/co2mon-git.tmpfiles.conf b/co2mon-git.tmpfiles.conf new file mode 100644 index 000000000000..631089488f87 --- /dev/null +++ b/co2mon-git.tmpfiles.conf @@ -0,0 +1 @@ +D /var/lib/co2mon 0755 nobody nobody 1m diff --git a/co2mon.service b/co2mon.service new file mode 100644 index 000000000000..632c058cdc53 --- /dev/null +++ b/co2mon.service @@ -0,0 +1,7 @@ +[Unit] +Description=Polling daemon for masterkit co2monitor + +[Service] +User=nobody +UMask=0022 +ExecStart=/usr/bin/co2mond -D /var/lib/co2mon/ |