# $Id: PKGBUILD 162160 2012-06-22 12:58:39Z dreisner $
# Contributor: Eric Johnson <eric@coding-zone.com>
# Maintainer: Thayer Williams <thayer@archlinux.org>

pkgname=i8kmon
pkgver=1.33
pkgrel=4
pkgdesc="Tk-based daemon for i8kutils and Dell Inspiron/Latitude notebooks"
arch=('any')
url="http://people.debian.org/~dz/i8k/"
license=('GPL2')
depends=('i8kutils' 'tk')
backup=('etc/i8kutils/i8kmon.conf' 'etc/conf.d/i8kmon')
source=(ftp://ftp.archlinux.org/other/i8kutils/i8kutils_$pkgver.tar.gz \
        i8kmon.daemon i8kmon.conf.d i8kmon.service)
sha1sums=('2701697dfe9c0e351cb412badd14fbf8191838c3'
          'a7ead36e31d27d85a257242847e316ea85a2426f'
          'a3a38c19f1af4bfc59ac8c88cadfa2e6ee185a4c'
          '9bac507e1ea80a240b01f07dded8a9a9fa406789')

build() {
  cd "$srcdir/i8kutils-$pkgver"

  # conform to Arch Linux guidelines
  sed -i 's|/etc/i8kmon|/etc/i8kutils/i8kmon.conf|g' i8kmon.1
  sed -i 's|/etc/i8kmon.conf|/etc/i8kutils/i8kmon.conf|g' i8kmon
}

package() {
  cd "$srcdir/i8kutils-$pkgver"

  # no configure script, and Makefile has /usr hardcoded
  install -D -m755 i8kmon "$pkgdir/usr/bin/i8kmon"
  install -D -m644 i8kmon.conf "$pkgdir/etc/i8kutils/i8kmon.conf"
  install -D -m644 i8kmon.1 "$pkgdir/usr/share/man/man1/i8kmon.1"

  # install daemon script.
  install -D -m755 ../i8kmon.daemon "$pkgdir/etc/rc.d/i8kmon"
  install -D -m644 ../i8kmon.conf.d "$pkgdir/etc/conf.d/i8kmon"

  install -D -m644 ../i8kmon.service "$pkgdir/usr/lib/systemd/system/i8kmon.service"
}
