# $Id$
# Maintainer: Sébastien Luttringer
# Contributor: xduugu
# Contributor: Manolis Tzanidakis
# Contributor: Jonathan Schmidt <j.schmidt@archlinux.us

pkgname=acpid
pkgver=2.0.26
pkgrel=1
pkgdesc='A daemon for delivering ACPI power management events with netlink support'
arch=('i686' 'x86_64')
url='http://sourceforge.net/projects/acpid2/'
license=('GPL')
depends=('bash')
optdepends=('perl: use perl based examples')
replaces=('acpid2')
backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything')
source=("http://downloads.sourceforge.net/sourceforge/acpid2/$pkgname-$pkgver.tar.xz"
        'acpid.service'
        'anything'
        'handler.sh')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sbindir=/usr/bin
  make
}

package() {
  pushd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  popd

  # default config
  install -Dm644 anything "$pkgdir/etc/acpi/events/anything"
  install -Dm755 handler.sh "$pkgdir/etc/acpi/handler.sh"

  # systemd
  install -Dm644 acpid.service "$pkgdir/usr/lib/systemd/system/acpid.service"

  # fix acpid rights
  chmod 755 "$pkgdir/usr/bin/acpid"
}

# vim:set ts=2 sw=2 et:
md5sums=('f6d772e35ed907f1cc14ad1a546fd473'
         'b9a9810eefae2142e20c965c01b410de'
         '2d37b98d6e74bab815604b8b48c6cfd4'
         'e97277eb1937c7ffe92a95fa60c073e4')