summaryrefslogtreecommitdiff
path: root/pcr/openrc/PKGBUILD
blob: c6be8b9f915846cac0c00bb1e4577fd41ffa4b09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>

# Maintainer (Manjaro): artoo <artoo@manjaro.org>
# Contributor (Manjaro): williamh <williamh@gentoo.org>
# Maintainer (AUR): Andrew Gregory <andrew.gregory.8@gmail.com>
# Contributor (AUR): Lone_Wolf <lonewolf.xs4all.nl>
# Contributor (AUR): Bartłomiej Piotrowski <nospam@bpiotrowski.pl>

pkgname=(openrc openrc-sysvinit)
pkgver=0.23
pkgdesc="A dependency based init system that works with the system provided init program"
url="https://www.gentoo.org/proj/en/base/openrc/"
license=('BSD2')

pkgrel=1
arch=('i686' 'x86_64' 'armv7h')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/OpenRC/openrc/archive/${pkgver}.tar.gz"
	"${pkgname}.logrotate")
sha256sums=('20d0f11c66f808ee99a69b99f7f3b774f217f62d0b6d6a5acb3e039808b0f326'
            '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c')
depends=(
	glibc
	pam # MKPAM=pam
	ncurses # MKTERMCAP=ncurses
)

_makeargs=(
	MKPAM=pam # either 'pam' or ''
	MKTERMCAP=ncurses # either 'ncurses' or 'termcap'

	PREFIX=/usr
	SYSCONFDIR=/etc # instead of ${PREFIX}/etc
	SBINDIR=/usr/bin # instead of ${PREFIX}/sbin
	LIBEXECDIR=/usr/lib/rc # instead of ${PREFIX}/libexec/rc

	# these default to 0444
	INCMODE=0644
	LIBMODE=0644
	MANMODE=0644
)

build(){
	cd "${srcdir}/${pkgname}-${pkgver}"
	make "${_makeargs[@]}"
}

package_openrc() {
	depends+=('openrc-init')
	backup=(
		etc/rc.conf
		# core
		etc/conf.d/{bootmisc,fsck,hostname,localmount,netmount,swap,urandom}
		# MKNET=yes (yes by default)
		etc/conf.d/{network,staticroute}
		# Linux-specific
		etc/conf.d/{consolefont,devfs,dmesg,hwclock,keymaps,killprocs,modules,mtab,net-online}
	)

	cd "${srcdir}/${pkgname}-${pkgver}"

	make DESTDIR="${pkgdir}" "${_makeargs[@]}" install

	install -Dm644 "${srcdir}/${pkgname}.logrotate" "${pkgdir}/etc/logrotate.d/${pkgname}"

	sed -e 's/#unicode="NO"/unicode="YES"/' \
	    -e 's/#rc_logger="YES"/rc_logger="YES"/' \
	    -i "${pkgdir}/etc/rc.conf"

	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}

package_openrc-sysvinit() {
	pkgdesc="OpenRC support for using sysvinit as pid 1"
	depends=(openrc sysvinit)
	provides=('openrc-init')
	backup=('etc/inittab')

	conflicts=('initscripts')

	cd "${srcdir}/${pkgbase}-${pkgver}"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
	install -Dm644 support/sysvinit/inittab "${pkgdir}/etc/inittab"
}