From 0db821e71f38ae2f8af265ab65816e977720946d Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 31 May 2020 23:45:17 +0000
Subject: powerpanel: update to 1.3.3

---
 abs/extra/powerpanel/PKGBUILD         | 96 ++++++++++++++++++++---------------
 abs/extra/powerpanel/hibernate.sh     |  3 ++
 abs/extra/powerpanel/pwrstatd.service |  2 +
 abs/extra/powerpanel/shutdown.sh      |  3 ++
 4 files changed, 62 insertions(+), 42 deletions(-)
 create mode 100755 abs/extra/powerpanel/hibernate.sh
 create mode 100755 abs/extra/powerpanel/shutdown.sh

diff --git a/abs/extra/powerpanel/PKGBUILD b/abs/extra/powerpanel/PKGBUILD
index b1377f1..3813e74 100644
--- a/abs/extra/powerpanel/PKGBUILD
+++ b/abs/extra/powerpanel/PKGBUILD
@@ -1,72 +1,84 @@
-# Maintainer: Justin Settle <jus10 [at] partlycloudy.org>
+# Maintainer: Jeff Henson <jeff@henson.io>
+# Contributor: Justin Settle <jus10 [at] partlycloudy.org>
 # Contributor: Kyle Keen <keenerd [at] gmail.com>, das-ich <das-ich [at] yandex.ru>
+
 pkgname=powerpanel
-pkgver=1.3.2
+pkgver=1.3.3
 pkgrel=1
 pkgdesc="CyberPower UPS daemon"
 arch=("x86_64" "i686")
-url="http://www.cyberpowersystems.com"
+url="https://www.cyberpowersystems.com/product/software/powerpanel-for-linux/"
 license=("custom:CyberPower")
 depends=('libusb')
 install=pwrstatd.install
 backup=(etc/powerpanel/pwrstatd-{powerfail,lowbatt,email}.sh
-    etc/pwrstatd.conf)
+        etc/powerpanel/{hibernate,shutdown}.sh
+        etc/pwrstatd.conf)
+
+source=('pwrstatd.service'
+        'hibernate.sh'
+        'shutdown.sh')
 
 if [[ $CARCH = 'x86_64' ]]; then
-  source=(http://www.cyberpowersystems.com/software/powerpanel-$pkgver-$CARCH.tar.gz pwrstatd.service)
-  md5sums=('d69233e117f92611931cb820bad141df'
-         'b945ff7c15ef206022c8df29a96338c8')
+  source+=("https://dl4jz3rbrsfum.cloudfront.net/software/PPL-${pkgver}-64bit.tar.gz")
 fi
 
 if [[ $CARCH = 'i686' ]]; then
-  source=(http://www.cyberpowersystems.com/software/powerpanel-$pkgver-i386.tar.gz pwrstatd.service)
-  md5sums=('833f35179a8b0ca303698de08f048c8b'
-       'b945ff7c15ef206022c8df29a96338c8')
+  source+=("https://dl4jz3rbrsfum.cloudfront.net/software/PPL-${pkgver}-32bit.tar.gz")
 fi
 
 package() {
-    cd ${srcdir}/$pkgname-$pkgver
-#
-# copy files
-#
+  cd "${srcdir}/$pkgname-$pkgver"
 
-# PowerPanel for Linux client program
-install -Dm755 bin/pwrstat ${pkgdir}/usr/bin/pwrstat
+  # 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 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
+  # 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 power failure
+  install -Dm755 script/pwrstatd-powerfail.sh "${pkgdir}/etc/powerpanel/pwrstatd-powerfail.sh"
+  sed -e 's#/etc#/etc/powerpanel#' -i "${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 event of battery low
+  install -Dm755 script/pwrstatd-lowbatt.sh "${pkgdir}/etc/powerpanel/pwrstatd-lowbatt.sh"
+  sed -e 's#/etc#/etc/powerpanel#' -i "${pkgdir}/etc/powerpanel/pwrstatd-lowbatt.sh"
 
-# Script command for e-mail notification
-install -Dm755 script/pwrstatd-email.sh ${pkgdir}/etc/powerpanel/pwrstatd-email.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
+  # Script for hibernate support
+  install -Dm755 "${srcdir}/hibernate.sh" "${pkgdir}/etc/powerpanel/hibernate.sh"
+  ln -s powerpanel/hibernate.sh "${pkgdir}/etc/hibernate.sh"
 
-# PowerPanel for Linux client man-page
-install -Dm644 doc/pwrstat.8 ${pkgdir}/usr/share/man/man8/pwrstat.8
+  # Script for shutdown support
+  install -Dm755 "${srcdir}/shutdown.sh" "${pkgdir}/etc/powerpanel/shutdown.sh"
+  ln -s powerpanel/shutdown.sh "${pkgdir}/etc/shutdown.sh"
 
-# PowerPanel for Linux daemon man-page
-install -Dm644 doc/pwrstatd.8 ${pkgdir}/usr/share/man/man8/pwrstatd.8
+  # Systemd unit
+  install -Dm644 "${srcdir}/pwrstatd.service" "${pkgdir}/usr/lib/systemd/system/pwrstatd.service"
 
-#
-# compress the man page file
-#
-gzip -9 ${pkgdir}/usr/share/man/man8/pwrstat.8
-gzip -9 ${pkgdir}/usr/share/man/man8/pwrstatd.8
+  # PowerPanel for Linux client man-page
+  install -Dm644 doc/pwrstat.8 "${pkgdir}/usr/share/man/man8/pwrstat.8"
 
-# Install License
-install -D -m644 doc/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+  # 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"
+
+  # Install License
+  install -D -m644 doc/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
 }
-md5sums=('d69233e117f92611931cb820bad141df'
-         'b945ff7c15ef206022c8df29a96338c8')
+
+md5sums=('b90f475b9dd875efca8c0de205ee642a'
+         '352d7cc8d4a3d3b7c7d6c8d51272ed39'
+         '3f582560f7e52461e28a3882d66f5fcb'
+         'd0af21f2e3f654a4813701932bb2fd2e')
diff --git a/abs/extra/powerpanel/hibernate.sh b/abs/extra/powerpanel/hibernate.sh
new file mode 100755
index 0000000..587ee6d
--- /dev/null
+++ b/abs/extra/powerpanel/hibernate.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+#systemctl hibernate
+/usr/bin/pm-hibernate
diff --git a/abs/extra/powerpanel/pwrstatd.service b/abs/extra/powerpanel/pwrstatd.service
index 9a1160c..222f4e5 100644
--- a/abs/extra/powerpanel/pwrstatd.service
+++ b/abs/extra/powerpanel/pwrstatd.service
@@ -2,6 +2,8 @@
 Description=PowerPanel for Linux software can be used with most CyberPower UPS products.
 
 [Service]
+Group=power
+UMask=0002
 ExecStart=/usr/bin/pwrstatd
 
 [Install]
diff --git a/abs/extra/powerpanel/shutdown.sh b/abs/extra/powerpanel/shutdown.sh
new file mode 100755
index 0000000..f477112
--- /dev/null
+++ b/abs/extra/powerpanel/shutdown.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+#systemctl poweroff
+/usr/bin/poweroff
-- 
cgit v0.12