DESCRIPTION = "vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s)."
HOMEPAGE = "https://humdi.net/vnstat/"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SECTION = "net"
DEPENDS = "gd sqlite3"

SRC_URI = "https://github.com/vergoh/vnstat/releases/download/v${PV}/${BPN}-${PV}.tar.gz"
SRC_URI[md5sum] = "fe2928a81243cc8a532a357f97221736"
SRC_URI[sha256sum] = "89276e0a7281943edb554b874078278ad947dc312938a2451e03eb80679f7ff7"

inherit autotools pkgconfig systemd

EXTRA_OECONF = "--disable-extra-paths"

do_install_append() {
    install -Dm644 ${S}/examples/systemd/vnstat.service "${D}${systemd_system_unitdir}/vnstat.service"
}

SYSTEMD_SERVICE_${PN} = "vnstat.service"

DESCRIPTION = "vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s)."
HOMEPAGE = "https://humdi.net/vnstat/"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SECTION = "net"
DEPENDS = "gd sqlite3"

SRC_URI = "https://github.com/vergoh/vnstat/releases/download/v${PV}/${BPN}-${PV}.tar.gz"
SRC_URI[md5sum] = "fe2928a81243cc8a532a357f97221736"
SRC_URI[sha256sum] = "89276e0a7281943edb554b874078278ad947dc312938a2451e03eb80679f7ff7"

inherit autotools pkgconfig systemd

EXTRA_OECONF = "--disable-extra-paths"

do_install_append() {
    install -Dm644 ${S}/examples/systemd/vnstat.service "${D}${systemd_system_unitdir}/vnstat.service"
}

PARALLEL_MAKEINST = ""

SYSTEMD_SERVICE_${PN} = "vnstat.service"

Disable install parallism to fix a potential install race
vnstat: Disable install parallism to fix a potential install race

It seems in some cases installing vnstati program races and is tried
twice, and second operation fails since it ensues somewhere between
the file being created by first operation and file actually being
created

   /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c vnstat vnstati '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/bin'
|  /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c -m 644 ../vnstat-2.6/man/vnstatd.8 '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/share/man/man8'
|  /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c -m 644 ../vnstat-2.6/man/vnstat.conf.5 '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/share/man/man5'
|  /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c -m 644 ../vnstat-2.6/man/vnstat.1 ../vnstat-2.6/man/vnstati.1 '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/share/man/man1'
| make  install-data-hook
| make[3]: Entering directory '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/build'
| Making install-exec in .
| make[4]: Entering directory '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/build'
|  /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/mkdir -p '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/bin'
|  /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/mkdir -p '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/sbin'
|   /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c vnstat vnstati '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/bin'
|   /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install -c vnstatd '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/sbin'
| /home/pokybuild/yocto-worker/meta-oe/build/build/tmp/hosttools/install: cannot create regular file '/home/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/vnstat/2.6-r0/image/usr/bin/vnstati': File exists
| make[4]: *** [Makefile:822: install-binPROGRAMS] Error 1

Signed-off-by: Khem Raj <729d64b6f67515e258459a5f6d20ec88b2caf8df@gmail.com>
