# Parabola maintainer: Michał Masłowski <mtjm@mtjm.eu>
# From https://aur.archlinux.org/packages.php?ID=24359
# Maintainer: nblock <nblock [/at\] archlinux DOT us>
# Contributor: Frederik Alkærsig (FALKER) <havnelisten AT gmail.com>

pkgname=thinkfan
pkgver=0.7.3
pkgrel=1
pkgdesc="A minimalist fan control program. Supports the sysfs hwmon interface and thinkpad_acpi"
arch=('i686' 'x86_64' 'mips64el')
license=('GPL3')
source=(http://downloads.sourceforge.net/project/${pkgname}/${pkgname}-${pkgver}.tar.gz "thinkfan")
url="http://thinkfan.sourceforge.net/"
#backup=('etc/thinkfan.conf')
md5sums=('d1b0d7a05b37cce412ee227cf759a9f6'
         '16fc3a83a1468e3ccaeba67e14ab2177')

build() {
    cd ${srcdir}/${pkgname}-${pkgver}
    make
    install -D -m755 ${pkgname} ${pkgdir}/usr/sbin/${pkgname}
    install -D -m755 ${srcdir}/${pkgname} ${pkgdir}/etc/rc.d/${pkgname}

    # A better way would be to check it at install time.
#    if ! [[ -f /proc/acpi/ibm/fan ]]; then 
#        echo "thinkpad_acpi procfs entries don't seem to exist." \
#        "You'll need to use the generic sysfs hwmon interface. Will use sysfs conf."
        install -D -m644 thinkfan.conf.sysfs ${pkgdir}/etc/thinkfan.conf.sysfs
#    else
#        echo "This seems to be a Thinkpad. You should use the IBM" \
#        "interface. Will use thinkfan conf."
        [ "${CARCH}" = "mips64el" ] || install -D -m644 thinkfan.conf.thinkpad ${pkgdir}/etc/thinkfan.conf.thinkpad
#    fi
}

# vim:set ts=2 sw=2 noet: