#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
# We thank both the Artix and Void Linux developer teams for the inspiration and work

#src-url="https://git.disroot/org/joborun/runit-rc"
_url="https://git.disroot.org/joborun-pkg/repos/raw/branch/main"

pkgname=runit-rc
pkgver=20230911
pkgrel=02
pkgdesc='Joborun Linux system initialization and shutdown for runit'
backup=('etc/rc/rc.conf' 'etc/rc.conf' )
depends=('procps-ng' 'bash' 'bootlogd' 'eudev')
optdepends=('lvm2-runit: LVM support for runit'
	'cryptsetup-runit: Enable boot support for encrypted partitions'
	'smbnetfs: to mount netfs volumes on stage1')
provides=('init-rc')
conflicts=('init-rc')
source=("$_url/$pkgname-$pkgver.tar.xz")

build() {
	cd ${pkgname}
	make
}

package() {
	cd ${pkgname}
	make DESTDIR="${pkgdir}" install-rc

	ln -s "/etc/rc/rc.conf" "${pkgdir}/etc/rc.conf"

###  If you want cgroups mounted by the init remove the following line
#	rm -rf "${pkgdir}/etc/rc/sysinit/04-cgroups"
###  or  # ln -s /usr/lib/rc/sv.d/cgroups /etc/rc/sysinit/04-cgroups
###  and they will be mounted on next boot 
	# iputils-specific configuration
	mkdir -p "$pkgdir/usr/lib/sysctl.d"
	mkdir -p "$pkgdir/usr/lib/rc"
	echo "net.ipv4.ping_group_range = 0 2147483647" > "$pkgdir/usr/lib/sysctl.d/55-iputils.conf"
}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('BSD')

sha256sums=(b1fccc2b5cec5248255449218ce90b69edd84faa4ee1bdbbddcd8350bdca3d50) # runit-rc-20230911.tar.xz

##  8c9fd4e5fbcb1dc0cf699fc2570e1ce6756179e2ad24f6e9de6266b5deb4b8ae  runit-rc-20230911-02-x86_64.pkg.tar.lz

