# $Id: Portfile 67277 2010-05-04 07:15:03Z toby@macports.org $

PortSystem 1.0

name            smartmontools
version         5.39.1
categories      sysutils
maintainers     toby
description     SMART hard drive monitoring
long_description \
    Two utility programs (smartctl and smartd) to control and monitor \
    storage systems using the Self-Monitoring, Analysis and Reporting \
    Technology System (SMART) built into most modern ATA and SCSI hard \
    disks. In many cases, these utilities will provide advanced warning \
    of disk degradation and failure.
homepage        http://smartmontools.sourceforge.net/
platforms       darwin
license         GPLv2
master_sites    sourceforge
checksums       md5 f6f7380ae45587161c0adae8862110e9 \
                sha1 ea0489c9234832f63ac0d4b4c0bd81133b4eb9e9 \
                rmd160 2adb8c43eb0f23711efce423c22281240a6ed172
configure.args  --mandir=${prefix}/share/man \
                --enable-drivedb \
                --enable-savestates \
                --enable-attributelog \
                --enable-sample

platform darwin {
    post-destroot {
        file delete -force ${destroot}${prefix}/etc/rc.d

        set launchd_path ${destroot}/Library/LaunchDaemons
        set launchd_plist net.sourceforge.smartmontools.smartd.plist

        xinstall -d ${launchd_path}
        xinstall -m 0644 ${filespath}/${launchd_plist} ${launchd_path}
        reinplace s|__PREFIX__|${prefix}| ${launchd_path}/${launchd_plist}

        if {${os.major} < 9} {
            reinplace s|KeepAlive|OnDemand| ${launchd_path}/${launchd_plist}
            reinplace s|true|false| ${launchd_path}/${launchd_plist}
        }
    }
}
