# Maintainer: Antoine Martin <dev@ayakael.net>
pkgname='organizr'
_pkgname='Organizr'
pkgver=20200712
pkgrel=1
pkgdesc='HTPC/HomeLab services organizer.'
arch="noarch"
url='https://github.com/causefx/Organizr'
license='GPL3'
depends='php7-sqlite3 php7'
install="$pkgname.post-install $pkgname.post-upgrade"
source="$pkgname-$pkgver.tar.gz"
_giturl="https://github.com/causefx/Organizr"
_gittag="00e3b99f641fa3853dbcb4db78743b09163d798a"
builddir="$srcdir/$pkgname"
options="!check"

snapshot() {
	mkdir -p "$srcdir"
	cd "${srcdir}"
	if ! [ -d $pkgname.git ]; then
		git clone $_giturl $pkgname.git || return 1
		cd $pkgname.git
	else
		cd $pkgname.git
		git fetch || return 1
	fi

	echo "Checking out"
	git checkout $_gittag
	echo "Repo archive"
	git archive --prefix="$pkgname/" -o $pkgname.tar --format "tar" $_gittag

	gzip $pkgname.tar -c > "$SRCDEST"/$pkgname-$pkgver.tar.gz
	ln -s "$SRCDEST"/$pkgname-$pkgver.tar.gz "$startdir"/$pkgname-$pkgver.tar.gz 
}

package() {
    install -dm 755 "${pkgdir}/usr/share/webapps/${pkgname}"
    install -dm 755 "${pkgdir}/var/lib/${pkgname}"
    cp -r "${srcdir}/${pkgname}/"* "${pkgdir}/usr/share/webapps/${pkgname}"
}
sha512sums="10f9085326f91d7dd3fb225b37ea69125599ec48ed7784fee163c1f35f2e2bd8f3f06f0c089d8df3e238e35881d0965858d84b442466c129c69d6fd161a6230b  organizr-20200712.tar.gz"
