summaryrefslogtreecommitdiff
path: root/pcr/openrc-core/PKGBUILD
blob: 589f1260c87aaf3ebb550d7e286b8a9debb9904a (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
# Maintainer (Manjaro): artoo <artoo@manjaro.org>
# Contributor (Manjaro): williamh <williamh@gentoo.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_src_uri="https://github.com"

_rc_uri="${_src_uri}/OpenRC/openrc/archive"
_net_uri="${_src_uri}/gentoo/netifrc/archive"
_func_uri="${_src_uri}/gentoo/gentoo-functions/archive"

_rc_ver=0.18.3
_net_ver=0.3.1
_func_ver=0.10

pkgver=${_rc_ver}
pkgrel=1
pkgbase=openrc-core
pkgname=('openrc' 'netifrc')
arch=('i686' 'x86_64' 'armv7h')
url="http://www.gentoo.org/proj/en/base/openrc/"
license=('BSD2')
source=("openrc-${_rc_ver}.tar.gz::${_rc_uri}/${_rc_ver}.tar.gz"
	"netifrc-${_net_ver}.tar.gz::${_net_uri}/${_net_ver}.tar.gz"
	"gentoo-functions-${_func_ver}.tar.gz::${_func_uri}/${_func_ver}.tar.gz"
	"openrc.logrotate"
	'LICENSE')
sha256sums=('e8e0bbefd8b40284a167af5c5071bd2eff6304988b3fd935bd6834c62cfa2339'
            '8ae41223cdc735eee8303e93959b31b6aeae6f1a08661ef5baa6373dd86419c7'
            '709c8b22f404001a512e47a7a4d3192070b3e150fb9d0f943de09736d665b0db'
            '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c'
            '28875cc6cb52e93657b96cf1bf0cc3b91891cdcbbc3196007c8cd93c6e22078f')

_configure_args() {
    _base_args=(SYSCONFDIR=/etc)
    _base_args+=(BRANDING="Parabola")
    _id="parabola"
    _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)

    _func_args+=(ROOTPREFIX=/usr)
    _func_args+=(ROOTSBINDIR=/usr/bin)
    _func_args+=(ROOTLIBEXECDIR=/usr/lib/$_id)

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

_configure_args

prepare(){
	cd "${srcdir}/openrc-${pkgver}"
	sed -e "s|/sbin|/usr/bin|g" -i support/sysvinit/inittab
}

build(){
	# make openrc
	cd "${srcdir}/openrc-${pkgver}"
	make "${_rc_args[@]}"
	# make netifrc
	cd "${srcdir}/netifrc-${_net_ver}"
	make "${_net_args[@]}"
	cd ${srcdir}/gentoo-functions-${_func_ver}
	make "${_func_args[@]}"
}

package_openrc() {
        pkgver=${_rc_ver}
        pkgrel=1
        pkgdesc="Gentoo's universal init system"
        depends=('inetutils' 'psmisc' 'sysvinit')
        optdepends=('netifrc: Network Interface Management Scripts'
                    'networkmanager-openrc: NetworkManager'
                    'connman-openrc: connman')
        conflicts=('systemd-sysvcompat' 'openrc-core')
        replaces=('openrc-core')
        install=${pkgname}.install
        backup=('etc/rc.conf'
                'etc/conf.d/consolefont'
                'etc/conf.d/keymaps'
                'etc/conf.d/hostname'
                'etc/conf.d/modules'
                'etc/conf.d/hwclock'
                'etc/inittab')

	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

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

package_netifrc() {
        pkgver=${_net_ver}
        pkgrel=3
        groups=('openrc-base')
        pkgdesc="Gentoo Network Interface Management Scripts"
        depends=('udev-openrc')
        install=${pkgname}.install
        backup=('etc/conf.d/net')

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

        install -d "${pkgdir}/etc/runlevels//boot"
        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"

        cd ${srcdir}/gentoo-functions-${_func_ver}
        make DESTDIR="${pkgdir}" "${_func_args[@]}" install

        sed -e "s|/lib/gentoo/functions.sh|/usr/lib/$_id/functions.sh|g" \
                -i "${pkgdir}/usr/lib/${pkgname}/sh/functions.sh"

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