# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname="inotify-tools-inc"
_realname="${pkgname%*-inc}"
pkgver=3.14
pkgrel=1
pkgdesc="inotify-tools patched to add --include regex"
url="https://github.com/rvoicilas/inotify-tools"
arch="all"
license="GPL-2.0"
depends="!inotify-tools"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/downloads/rvoicilas/$_realname/$_realname-$pkgver.tar.gz
	add-include-regex.patch
	"

builddir="$srcdir"/$_realname-$pkgver

prepare() {
	default_prepare || return 1
	update_config_guess || return 1
}

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1
	make || return 1
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install || return 1
	# post-install message
	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
        cat > $pkgdir/usr/share/doc/$pkgname/example.sh <<EOF
#!/bin/sh
## watch for a specific file recursively ##
inotifywait -mr -e modify /path/to/watch --include="(my.file)$" |
while read path action file; do
	echo "The file '$file' appeared in directory '$path' via '$action'"
done
EOF
}

md5sums="b43d95a0fa8c45f8bab3aec9672cf30c  inotify-tools-3.14.tar.gz
72f3ffd0d57ddb2b6b38faaa3b751ca8  add-include-regex.patch"
sha256sums="222bcca8893d7bf8a1ce207fb39ceead5233b5015623d099392e95197676c92f  inotify-tools-3.14.tar.gz
5b193b9b5cbd16d4aca9ce843a8493191cbf825598978a2602180fc28d56ffd7  add-include-regex.patch"
sha512sums="6074d510e89bba5da0d7c4d86f2562c662868666ba0a7ea5d73e53c010a0050dd1fc01959b22cffdb9b8a35bd1b0b43c04d02d6f19927520f05889e8a9297dfb  inotify-tools-3.14.tar.gz
b858b79dcfb2967d0c8d31ecbc17f4f36064218d2276fdafcdc6c8e51c9db2645fa102f88f1401b78f79a1b2ddbe400ea3e691bf93d084ecb312a170f69bda24  add-include-regex.patch"
