updated on Sun Jan 22 04:03:10 UTC 2012
[aur-mirror.git] / upsmon / PKGBUILD
blob7c6ed18858a12dda7d21a4f06505cecff0b4dd83
1 # Maintainer: Andrea Repetto <darkraziel at libero dot it>
3 pkgname=upsmon
4 pkgver=5.1.0
5 pkgrel=2
6 pkgdesc="Powershield 3 UPS Monitor for Riello UPS series"
7 arch=('i686' 'x86_64')
8 url="http://www.riello-ups.com/?en/downloads/1/powershield3-free"
9 license=('custom')
10 depends=('sh' 'bash')
11 optdepends=('java-runtime: to execute the graphical utilities')
12 source=(upsmon.d ups-run-as-root
13         xupsetup.desktop xupsview.desktop xwizsetup.desktop)
14 md5sums=('e27cf56a3019669d198759ce464d3d20'
15          '4948b07103213041b911bf8571706911'
16          'a9db7ed077c02d14f3b2bf08a053ff76'
17          '55d6adbd80341faf59ff7ad0eb5765dd'
18          '7b0aeda87f3c5b02d6358be2802b5c70')
19 if [ "$CARCH" = "i686" ]; then
20         _arch='intel'
21         _pkg="$pkgname-$pkgver-linux-2.6-$_arch"
22         source+=("http://www.riello-ups.com/areaftp/Linux-RedHat-i386/$_pkg.rpm")
23         md5sums+=('0e32179283180315597aefc13f7b5895')
24 elif [ "$CARCH" = "x86_64" ]; then
25         _arch='x86_64'
26         _pkg="$pkgname-$pkgver-linux-2.6-$_arch"
27         source+=("http://www.riello-ups.com/areaftp/Linux-RedHat-x86_64/$_pkg.rpm")
28         md5sums+=('d38b3bde8b5d4457874d774934ae2756')
31 install=upsmon.install
32 backup=('opt/upsmon/upsmon.ini')
34 build() {
35         
36   cd $srcdir
37   
38   # Unpack the rpm package
39   bsdtar -xf $_pkg.rpm
40   
41   # Install license
42   install -D -m644 $srcdir/opt/$pkgname/License.txt \
43   "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
44   
45   # Copy files in /etc
46   install -d $pkgdir/etc/rc.d/
47   install -D -m755 $srcdir/upsmon.d $pkgdir/etc/rc.d/upsmon
48   
49   # Copy files in /opt
50   install -d $pkgdir/opt/$pkgname
51   cp -r $srcdir/opt/$pkgname/* $pkgdir/opt/$pkgname
52   
53   # Replace init.d with rc.d in the start/stop/restart scripts
54   cd $pkgdir/opt/$pkgname
55   echo upsstart upsstop upsrestart | xargs sed -i 's/init.d/rc.d/'
56    
57   # Copy files in /usr/bin
58   install -D -m755 $srcdir/ups-run-as-root $pkgdir/usr/bin/ups-run-as-root
59    
60   # Create scripts for running applications
61   install -d $pkgdir/usr/bin
62   
63   local _apps=(upsetup upsview xupsetup xupsview xwizsetup)
64   for _app in ${_apps[@]}; do
65     cat > $pkgdir/usr/bin/$_app <<EOF
66 #!/bin/bash
68 cd "/opt/upsmon"
69 ./$_app
70 EOF
71     chmod 755 $pkgdir/usr/bin/$_app
72   done
73     
74   # Fix permissions for directories
75   chmod a+x $pkgdir/opt/upsmon/images
76   chmod a+x $pkgdir/opt/upsmon/html
77   
78   # Add desktop entries
79   install -d $pkgdir/usr/share/applications
80   install -D -m644 $srcdir/xupsetup.desktop $pkgdir/usr/share/applications/
81   install -D -m644 $srcdir/xupsview.desktop $pkgdir/usr/share/applications/
82   install -D -m644 $srcdir/xwizsetup.desktop $pkgdir/usr/share/applications/
85 # vim:set ts=2 sw=2 et: