# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=cachefilesd
pkgver=0.10.10
pkgrel=0
pkgdesc="Userspace daemon acting as a backend for FS-Cache"
url="http://people.redhat.com/~dhowells/fscache/"
arch="all"
license="GPL"
depends="attr"
makedepends="rpm file"
options="!check"
subpackages="$pkgname-doc"
source="http://people.redhat.com/~dhowells/cachefs/$pkgname-$pkgver.tar
	$pkgname.initd"
builddir="$srcdir"/$pkgname-$pkgver

build() {
	cd "$builddir"
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.c
	sed -i "s#/sbin/#/usr/bin/#g" cachefilesd.service
	make CFLAGS="$CFLAGS"
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" SBINDIR=/usr/bin install
	mkdir -p "$pkgdir"/var/cache/fscache
	install -D -m 755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
}

sha512sums="d7d816b5ef1fffe1272cb8c2e9cbd18c1393438afca250436a36a446c6a37303e7784057725a56be839e0489101190b563c4fc015fc4ff11baa8003121e5183a  cachefilesd-0.10.10.tar
854b66470ace24caf24e979de3c1c12a426972bc745823b3a0f47ac80811ac5da4fa6a249e65386acdec2e7561178bb1d2c4b301a2178458f10496bb8eac5b2f  cachefilesd.initd"
