From 2c4661dddbecc5983a711c2b244e47c6f1cfee49 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 1 Dec 2014 14:55:46 +0000
Subject: powerpanel: initial inclusion. closes #982

---
 abs/extra/powerpanel/PKGBUILD         | 69 +++++++++++++++++++++++++++++++++++
 abs/extra/powerpanel/__changelog      |  2 +
 abs/extra/powerpanel/pwrstatd.install | 14 +++++++
 abs/extra/powerpanel/pwrstatd.service |  8 ++++
 4 files changed, 93 insertions(+)
 create mode 100644 abs/extra/powerpanel/PKGBUILD
 create mode 100644 abs/extra/powerpanel/__changelog
 create mode 100644 abs/extra/powerpanel/pwrstatd.install
 create mode 100644 abs/extra/powerpanel/pwrstatd.service

diff --git a/abs/extra/powerpanel/PKGBUILD b/abs/extra/powerpanel/PKGBUILD
new file mode 100644
index 0000000..22edba7
--- /dev/null
+++ b/abs/extra/powerpanel/PKGBUILD
@@ -0,0 +1,69 @@
+# Contributor: das-ich <das-ich@yandex.ru>
+pkgname=powerpanel
+pkgver=1.2.3
+pkgrel=6
+pkgdesc="PowerPanel for Linux software can be used with most CyberPower UPS products."
+arch=("x86_64" "i686")
+url="http://www.cyberpowersystems.com"
+license=("custom:CyberPower")
+depends=('libusb')
+install=pwrstatd.install
+source=(http://www.cyberpowersystems.com/software/powerpanel_123_x86_64.tar.gz pwrstatd.service)
+backup=(etc/powerpanel/pwrstatd-{powerfail,lowbatt,email}.sh
+	etc/pwrstatd.conf)
+
+if [ "$CARCH" = "x86_64" ]; then
+  md5sums=('0226b17e9470b93cd1e4fd2f149c5d05'
+	    'b945ff7c15ef206022c8df29a96338c8')
+fi
+
+if [ "$CARCH" = "i686" ]; then
+source=(http://www.cyberpowersystems.com/software/powerpanel_123_i386.tar.gz)
+  md5sums=('79d1b60f5146b5286c786c93b90e6c87'
+	    'b945ff7c15ef206022c8df29a96338c8')
+fi
+
+package() {
+	cd ${srcdir}/$pkgname-$pkgver-0
+#
+# copy files
+#
+
+# PowerPanel for Linux client program
+install -Dm755 bin/pwrstat ${pkgdir}/usr/bin/pwrstat
+
+# PowerPanel for Linux daemon program
+install -Dm755 bin/pwrstatd ${pkgdir}/usr/bin/pwrstatd
+
+# PowerPanel for Linux daemon configuration
+install -Dm600 conf/pwrstatd.conf ${pkgdir}/etc/pwrstatd.conf
+sed -e 's#/etc#/etc/powerpanel#' -i ${pkgdir}/etc/pwrstatd.conf
+
+# Script command for event of power failure
+install -Dm755 script/pwrstatd-powerfail.sh ${pkgdir}/etc/powerpanel/pwrstatd-powerfail.sh
+
+# Script command for event of battery low
+install -Dm755 script/pwrstatd-lowbatt.sh ${pkgdir}/etc/powerpanel/pwrstatd-lowbatt.sh
+
+# Script command for e-mail notification
+install -Dm755 script/pwrstatd-email.sh ${pkgdir}/etc/powerpanel/pwrstatd-email.sh
+
+# Systemd unit
+install -Dm644 ../pwrstatd.service ${pkgdir}/usr/lib/systemd/system/pwrstatd.service
+
+# PowerPanel for Linux client man-page
+install -Dm644 doc/pwrstat.8 ${pkgdir}/usr/share/man/man8/pwrstat.8
+
+# PowerPanel for Linux daemon man-page
+install -Dm644 doc/pwrstatd.8 ${pkgdir}/usr/share/man/man8/pwrstatd.8
+
+#
+# compress the man page file
+#
+gzip -9 ${pkgdir}/usr/share/man/man8/pwrstat.8
+gzip -9 ${pkgdir}/usr/share/man/man8/pwrstatd.8
+
+}
+
+md5sums=('0226b17e9470b93cd1e4fd2f149c5d05'
+         'b945ff7c15ef206022c8df29a96338c8')
diff --git a/abs/extra/powerpanel/__changelog b/abs/extra/powerpanel/__changelog
new file mode 100644
index 0000000..503964f
--- /dev/null
+++ b/abs/extra/powerpanel/__changelog
@@ -0,0 +1,2 @@
+add pwrstatd.install to have runit start the service
+
diff --git a/abs/extra/powerpanel/pwrstatd.install b/abs/extra/powerpanel/pwrstatd.install
new file mode 100644
index 0000000..5fe72ff
--- /dev/null
+++ b/abs/extra/powerpanel/pwrstatd.install
@@ -0,0 +1,14 @@
+post_install() {
+    add_service.sh pwrstatd
+    sv start pwrstatd
+}
+
+post_upgrade() {
+    post_install
+    sv restart pwrstatd
+}
+
+post_remove() {
+    sv stop pwrstatd
+    remove_service.sh pwrstatd
+}
diff --git a/abs/extra/powerpanel/pwrstatd.service b/abs/extra/powerpanel/pwrstatd.service
new file mode 100644
index 0000000..9a1160c
--- /dev/null
+++ b/abs/extra/powerpanel/pwrstatd.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=PowerPanel for Linux software can be used with most CyberPower UPS products.
+
+[Service]
+ExecStart=/usr/bin/pwrstatd
+
+[Install]
+WantedBy=multi-user.target
-- 
cgit v0.12

