You are not logged in.

#1 2013-06-08 15:47:03

aexoxea
Member
Registered: 2012-11-17
Posts: 62

[Solved] PKGBUILD Update for powerpanel

This is the third of five packages I'm looking at, per the original post.

The third package is aur/powerpanel (1.2.3-3). This one was a little curious; it claimed to install a binary under /usr/sbin, but the end package would have no non-'meta' files in it at all (and thus would install nothing). I believe this is due to the use of $startdir in the original PKGBUILD, though I can't be certain.

Flagged as before, but no inspection of the source as this fetches a pre-built binary from the vendor. No issues so far at my end (and hopefully none for anyone else). Of course, this means that once again, the only affected file was the PKGBUILD, for which I include updates below.


PKGBUILD.diff (to make a new PKGBUILD) -- In addition to correcting the install path, this fixes an error and several warnings noted by namcap, and also several warnings by makepkg.
Edited 09 June 2013 per Scimmia [#1285083]

--- PKGBUILD	2013-02-14 19:26:52.000000000 +1100
+++ PKGBUILD	2013-06-09 14:30:24.034932202 +1000
@@ -2,68 +2,70 @@
 pkgname=powerpanel
 pkgver=1.2.3
 pkgrel=3
-pkgdesc="PowerPanel for Linux software can be used with most CyberPower UPS products."
-arch=("x86_64" "i686")
-url="http://www.cyberpowersystems.com"
+pkgdesc="This Linux package can be used with most CyberPower UPS products."
+arch=('x86_64' 'i686')
+url="http://www.cyberpowersystems.com/"
 license=("custom:CyberPower")
-depends=('libusb')
-source=(http://www.cyberpowersystems.com/software/powerpanel_123_x86_64.tar.gz pwrstatd.service)
+depends=('bash')
+source=(pwrstatd.service)
 backup=(etc/powerpanel/pwrstatd-{powerfail,lowbatt,email}.sh
 	etc/pwrstatd.conf)
 
 if [ $CARCH = 'x86_64' ]; then
-  md5sums=('0226b17e9470b93cd1e4fd2f149c5d05'
-	    '1d92c092af4bbb55add35d30c6b37252')
+source+=("http://www.cyberpowersystems.com/software/powerpanel_123_x86_64.tar.gz")
+md5sums=('1d92c092af4bbb55add35d30c6b37252'
+	 '0226b17e9470b93cd1e4fd2f149c5d05')
 fi
 
 if [ $CARCH = 'i686' ]; then
-source=(http://www.cyberpowersystems.com/software/powerpanel_123_i386.tar.gz)
-  md5sums=('79d1b60f5146b5286c786c93b90e6c87'
-	    '1d92c092af4bbb55add35d30c6b37252')
+source+=("http://www.cyberpowersystems.com/software/powerpanel_123_i386.tar.gz")
+md5sums=('1d92c092af4bbb55add35d30c6b37252'
+	 '79d1b60f5146b5286c786c93b90e6c87')
 fi
 
-build() {
-	cd $startdir/src/$pkgname-$pkgver-0
-#
-# copy files
+package() {
+
 #
+# File install operations.
 
 # PowerPanel for Linux client program
-install -Dm755 bin/pwrstat $startdir/pkg/usr/bin/pwrstat
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/bin/pwrstat" "$pkgdir/usr/bin/pwrstat"
 
 # PowerPanel for Linux daemon program
-install -Dm755 bin/pwrstatd $startdir/pkg/usr/sbin/pwrstatd
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/bin/pwrstatd" "$pkgdir/usr/bin/pwrstatd"
 
 # PowerPanel for Linux daemon configuration
-install -Dm600 conf/pwrstatd.conf $startdir/pkg/etc/pwrstatd.conf
-sed -e 's#/etc#/etc/powerpanel#' -i $startdir/pkg/etc/pwrstatd.conf
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/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 $startdir/pkg/etc/powerpanel/pwrstatd-powerfail.sh
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/script/pwrstatd-powerfail.sh" "$pkgdir/etc/powerpanel/pwrstatd-powerfail.sh"
 
 # Script command for event of battery low
-install -Dm755 script/pwrstatd-lowbatt.sh $startdir/pkg/etc/powerpanel/pwrstatd-lowbatt.sh
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/script/pwrstatd-lowbatt.sh" "$pkgdir/etc/powerpanel/pwrstatd-lowbatt.sh"
 
 # Script command for e-mail notification
-install -Dm755 script/pwrstatd-email.sh $startdir/pkg/etc/powerpanel/pwrstatd-email.sh
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/script/pwrstatd-email.sh" "$pkgdir/etc/powerpanel/pwrstatd-email.sh"
 
 # Script command for Daemon startup control
-install -Dm755 script/arch_pwrstatd $startdir/pkg/etc/rc.d/pwrstatd
+install -Dm755 "$srcdir/$pkgname-$pkgver-0/script/arch_pwrstatd" "$pkgdir/etc/rc.d/pwrstatd"
 
 # Systemd unit
-install -Dm644 ../pwrstatd.service $startdir/pkg/usr/lib/systemd/system/pwrstatd.service
+install -Dm644 pwrstatd.service "$pkgdir/usr/lib/systemd/system/pwrstatd.service"
 
 # PowerPanel for Linux client man-page
-install -Dm644 doc/pwrstat.8 $startdir/pkg/usr/share/man/man8/pwrstat.8
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/pwrstat.8" "$pkgdir/usr/share/man/man8/pwrstat.8"
 
 # PowerPanel for Linux daemon man-page
-install -Dm644 doc/pwrstatd.8 $startdir/pkg/usr/share/man/man8/pwrstatd.8
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/pwrstatd.8" "$pkgdir/usr/share/man/man8/pwrstatd.8"
 
-#
-# compress the man page file
-#
-gzip -9 $startdir/pkg/usr/share/man/man8/pwrstat.8
-gzip -9 $startdir/pkg/usr/share/man/man8/pwrstatd.8
+# PowerPanel license file
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/LICENSE" "$pkgdir/usr/share/licenses/powerpanel/LICENSE"
 
-}
+# PowerPanel additional documentation
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/README" "$pkgdir/usr/share/doc/powerpanel/README"
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/deploy-guide" "$pkgdir/usr/share/doc/powerpanel/deploy-guide"
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/install-guide" "$pkgdir/usr/share/doc/powerpanel/install-guide"
+install -Dm644 "$srcdir/$pkgname-$pkgver-0/doc/user-manual" "$pkgdir/usr/share/doc/powerpanel/user-manual"
 
+}

A fair number of changes, but mostly straightforwards, and I did otherwise try and make as few changes as possible to the original PKGBUILD. Again, any (constructive) feedback is welcome. I will of course add a comment to the package page in AUR noting this topic.

Last edited by aexoxea (2013-06-10 04:42:08)

Offline

#2 2013-06-08 15:55:21

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,975

Re: [Solved] PKGBUILD Update for powerpanel

Quote all paths which include variables
makepkg will already compress man pages, you don't need to do it on your own.
I would suggest using source+= to add the service file instead of listing the same thing twice, giving you two places to update it if you have to change it.

Offline

#3 2013-06-09 04:51:43

aexoxea
Member
Registered: 2012-11-17
Posts: 62

Re: [Solved] PKGBUILD Update for powerpanel

Scimmia wrote:

Quote all paths which include variables
makepkg will already compress man pages, you don't need to do it on your own.
I would suggest using source+= to add the service file instead of listing the same thing twice, giving you two places to update it if you have to change it.

Changes made (and now reflected in the OP), and these points noted for future work. I've also made additional use of $pkgname and $pkgver in a similar vein. Again, many thanks for the feedback smile.

Offline

#4 2013-06-09 19:13:54

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,975

Re: [Solved] PKGBUILD Update for powerpanel

"md5sums+=" works, too. smile

I would try to include $pkgver in the source array, something like ${pkgver//./} to get rid of the dots. That way you only have to update the pkgver at the top on an update.

Offline

#5 2013-06-10 04:41:39

aexoxea
Member
Registered: 2012-11-17
Posts: 62

Re: [Solved] PKGBUILD Update for powerpanel

Scimmia wrote:

"md5sums+=" works, too. smile

I would try to include $pkgver in the source array, something like ${pkgver//./} to get rid of the dots. That way you only have to update the pkgver at the top on an update.

[#1285717]

Good point about the md5sums= wink and also about using variables in the source= (which I note a number of packages indeed do).

As it is, the maintainer has yesterday updated the PKGBUILD (using only some of the changes from the above), so I'm going to mark this thread as 'solved', but will take note of everything above for future PKGBUILDs that I write or modify (I'm sure this one won't be the last).

Offline

Board footer

Powered by FluxBB