summaryrefslogtreecommitdiff
path: root/pcr/openrc-core/PKGBUILD
blob: 39e021536d9d602a81993ddacd8a0b6393483eb0 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Maintainer (Arch): artoo <artoo@manjaro.org>
# Contributor (Arch): williamh <williamh@gentoo.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: freaj <freaj@riseup.net>

_pkgname="openrc"

_src_uri="http://dev.gentoo.org/~williamh/dist"
_net_uri="http://dev.gentoo.org/~robbat2/distfiles"
_g_uri="https://github.com/gentoo/gentoo-functions/archive" #/0.10.tar.gz

_udev="udev-init-scripts"
_uver=30

_net="netifrc"
_nver=0.3.1

_genf="gentoo-functions"
_gver=0.10

pkgname=openrc-core
pkgdesc="Gentoo's universal init system, udev enabled."
pkgver=0.16.4
pkgrel=3
pkgdesc="Gentoo's universal init system, udev enabled."
arch=('i686' 'x86_64')
url="http://www.gentoo.org/proj/en/base/openrc/"
license=('BSD2' 'GPL2')
depends=('inetutils' 'psmisc' 'sysvinit' 'udev>=186')
optdepends=('dhcpcd-openrc: dhcpcd initscript')
conflicts=('openrc' 'openrc-git' 'initscripts' 'systemd-sysvcompat' 'openrc-sysvinit'
			'eudev-openrc')
backup=('etc/rc.conf'
	'etc/conf.d/consolefont'
	'etc/conf.d/keymaps'
	'etc/conf.d/hostname'
	'etc/conf.d/modules'
	'etc/conf.d/net'
	'etc/conf.d/hwclock'
	'etc/inittab')
install=${_pkgname}.install
source=("${_src_uri}/${_pkgname}-${pkgver}.tar.bz2"
	"${_src_uri}/${_udev}-${_uver}.tar.gz"
	"${_net_uri}/${_net}-${_nver}.tar.bz2"
	"${_genf}-${_gver}::${_g_uri}/${_gver}.tar.gz"
	"${_pkgname}.logrotate"
	'kmod-static-nodes')
sha256sums=('6771257e208da2e4d20b4ac2e3e7f065eb8873566644ff385e9dbd6bc5221d21'
            '4de998d68e28f8ce4c1d4c9955aec0fa4cfe84673cbf3bfe1be71a1e9918693f'
            'a92a96b6f065981ee1c0232a507f3695230eeb7fb6172ec9048c2538b36cfea8'
            '709c8b22f404001a512e47a7a4d3192070b3e150fb9d0f943de09736d665b0db'
            '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c'
            'fc90e8d480de39aff90e41477f79720a98bee2a2359c53c209d0ca7bb75fb6ba')

_base_args=(SYSCONFDIR=/etc)
if [ -f /etc/os-release ]; then
    . /etc/os-release
    _base_args+=(BRANDING="$NAME")

else
    _base_args+=(BRANDING='Unknown Linux')
fi
_base_args+=(PREFIX=/usr)
_base_args+=(SBINDIR=/usr/bin)

_rc_args=( "${_base_args[@]}" )
_rc_args+=(LIBEXECDIR=/usr/lib/rc)
_rc_args+=(MKSELINUX=no)
_rc_args+=(MKPAM=pam)
_rc_args+=(MKTERMCAP=ncurses)
_rc_args+=(MKNET=no)

_f_args+=(ROOTPREFIX=/usr)
_f_args+=(ROOTSBINDIR=/usr/bin)
_f_args+=(ROOTLIBEXECDIR=/usr/lib/manjaro)

_net_args=( "${_base_args[@]}" )
_net_args+=(LIBEXECDIR=/usr/lib/${_net})

prepare(){
	cd "${srcdir}/${_pkgname}-${pkgver}"
	sed -e "s|/sbin|/usr/bin|g" -i support/sysvinit/inittab
	#sed -i 's:0444:0644:' mk/sys.mk
}

build(){
	# make openrc
	cd "${srcdir}/${_pkgname}-${pkgver}"
	make "${_rc_args[@]}"
	# make netifrc
	cd "${srcdir}/${_net}-${_nver}"
	make "${_net_args[@]}"
	cd ${srcdir}/${_genf}-${_gver}
	make "${_f_args[@]}"
}

package() {
	cd "${srcdir}/${_pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" "${_rc_args[@]}" install
	install -m644 "${srcdir}/${_pkgname}-${pkgver}/support/sysvinit/inittab" "${pkgdir}/etc/inittab"
	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 -d ${pkgdir}/usr/lib/rc/cache

	# udev
	cd "${srcdir}/${_udev}-${_uver}"
	make DESTDIR="${pkgdir}" install
	sed -e "s|/sbin/udevd|/usr/bin/udevd|g" \
		-e "s|#!/sbin/runscript|#!/usr/bin/openrc-run|" \
		-i ${pkgdir}/etc/init.d/udev
	for f in ${pkgdir}/etc/init.d/udev-trigger ${pkgdir}/etc/init.d/udev-settle;do
		sed -e "s|#!/sbin/openrc-run|#!/usr/bin/openrc-run|" \
			-e "s|/bin/udevadm|/usr/bin/udevadm|g" \
			-i "$f"
	done
	cd "${srcdir}/${_pkgname}-${pkgver}"
	ln -sf "/etc/init.d/udev" "${pkgdir}/etc/runlevels/sysinit/udev"
	ln -sf "/etc/init.d/udev-trigger" "${pkgdir}/etc/runlevels/sysinit/udev-trigger"

	# netifrc
	cd "${srcdir}/${_net}-${_nver}"
	make DESTDIR="${pkgdir}" "${_net_args[@]}" install
	install -Dm 644 "${srcdir}/${_net}-${_nver}/doc/net.example" "${pkgdir}/etc/conf.d/net"

	sed -e 's|#!/usr/bin/runscript|#!/usr/bin/openrc-run|' \
	    -i "${pkgdir}/etc/init.d/net.lo"
	ln -sf "/etc/init.d/net.lo" "${pkgdir}/etc/runlevels/boot/net.lo"
	sed -e 's|/lib/gentoo/functions.sh|/usr/lib/manjaro/functions.sh|g' \
		-i "${pkgdir}/usr/lib/netifrc/sh/functions.sh"

	# kmod-static-nodes
	cd "${srcdir}/${_pkgname}-${pkgver}"
	install -Dm755 "${srcdir}/kmod-static-nodes" "${pkgdir}/etc/init.d/kmod-static-nodes"
	ln -sf "/etc/init.d/kmod-static-nodes" "${pkgdir}/etc/runlevels/sysinit/kmod-static-nodes"

	cd ${srcdir}/${_genf}-${_gver}
	make DESTDIR="${pkgdir}" "${_f_args[@]}" install
}