# $Id: PKGBUILD 228763 2015-01-08 20:28:38Z eric $
# Maintainer: 

pkgname=i8kutils
pkgver=1.42
pkgrel=1
pkgdesc="Dell Inspiron/Latitude kernel driver and utilities"
arch=('i686' 'x86_64')
url="https://launchpad.net/i8kutils"
license=('GPL')
depends=('bash' 'acpi')
optdepends=('tk: for i8kmon deamon')
backup=('etc/i8kutils/i8kmon.conf')
source=(https://launchpad.net/i8kutils/trunk/${pkgver}/+download/i8kutils_${pkgver}.tar.xz
        i8kmon.service)
sha1sums=('6c32176a94ae6e0f6969880ac7ab8ac76b476143'
          '5c20f5241de7e60b46117269f4e867b08734cdc8')

prepare() {
  cd $pkgname
  # 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
  make clean
}

build() {
  cd $pkgname
  make
}

package() {
  cd $pkgname
  install -d "$pkgdir"/usr/{bin,share/man/man1}
  install -D -m644 i8kctl.1 i8kmon.1 "$pkgdir/usr/share/man/man1"
  install -D -m755 i8kctl i8kfan i8kmon "$pkgdir/usr/bin"

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