#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/obarun/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
# Maintainer    : Eric Vidal <eric@obarun.org>

pkgname=66
pkgver=0.6.2.0
pkgrel=05
# change in uid for s6log
pkgdesc="Small tools built around s6 and s6-rc programs"
url='https://git.obarun.org/Obarun/66.git'
source=("${pkgname}::git+${url}#tag=v$pkgver"
	66.install)
#	direct:  https://git.obarun.org/pkg/obcore/66/-/raw/master/trunk/66.install

makedepends=('git' 'skalibs>=2.11.2.0' 'execline>=2.8.3.0' 's6>=2.11.1.0' 's6-rc>=0.5.2.3' 'oblibs>=0.1.4.0' 'lowdown' 'linux-api-headers')
depends=('skalibs>=2.11.2.0' 'execline>=2.8.3.0' 's6>=2.11.1.0' 's6-rc>=0.5.2.3' 'oblibs>=0.1.4.0')
arch=(x86_64)

backup=('etc/66/init.conf'
	'etc/66/rc.init'
	'etc/66/rc.init.container'
	'etc/66/rc.shutdown'
	'etc/66/rc.shutdown.final'
	'usr/bin/init')

conflicts=('s6-linux-init')

groups=('s6-suite')

install=66.install

build() {
	cd $pkgname
	./configure --bindir=/usr/bin \
	--shebangdir=/usr/bin \
	--with-system-service=/usr/lib/66/service \
	--with-system-module=/usr/lib/66/module \
	--with-system-script=/usr/lib/66/script \
	--with-s6-log-timestamp=iso \
	--with-s6-log-user=s6log \
	--with-lib=/usr/lib/skalibs \
	--with-lib=/usr/lib/execline \
	--with-lib=/usr/lib/s6 \
	--with-lib=/usr/lib/s6-rc \
	--with-lib=/usr/lib/oblibs \
	--disable-shared
	make
}

package() {
	cd $pkgname

	make DESTDIR="$pkgdir" install

	## copy wrapper at the correct place
	cp "$pkgdir"/etc/66/init "$pkgdir"/usr/bin
	mkdir -p "$pkgdir"/usr/bin/s6
	## move powerfunctions according to joborun66 ##
	mv "$pkgdir"/etc/66/{halt,poweroff,reboot,shutdown} "$pkgdir"/usr/bin/s6
	## 66 License ##
	install -Dm 0644 LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

#---- license gpg-key sha256sums ----

license=(ISC)

sha256sums=(SKIP
	2560ad31407cf17fbec2e52526cb1515424b9436cb4c1664e64578b5d78326a3) # 66.install

