summaryrefslogtreecommitdiff
path: root/nonsystemd/openrc/PKGBUILD
blob: bc4dd651a3e041668849f3637f24e8df5a8712b8 (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Maintainer: David P. <megver83@parabola.nu>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>

# Maintainer (Artix): artoo <artoo@artixlinux.org>
# Maintainer (Artix): Chris Cromer <cromer@artixlinux.org>
# Contributor (Artix): williamh <williamh@gentoo.org>

pkgbase=openrc
pkgname=('openrc' 'openrc-bash-completions' 'openrc-zsh-completions'
         'openrc-init' 'openrc-sysvinit' 'openrc-net')
pkgver=0.42.1
pkgrel=5
pkgdesc="Gentoo's universal init system"
arch=('x86_64' 'i686' 'armv7h')
url="https://github.com/OpenRC/openrc"
license=('BSD2')
source=("${pkgbase}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz"
        "revert.patch::${url}/commit/1801561c2d36c330df7fd02c7508f503a61ff5ba.patch"
        "${pkgbase}.logrotate"
        'openrc-hook'
        '30-openrc-upgrade.hook'
        '30-sysctl.hook'
        'sysctl.conf'
        '30-binfmt.hook'
        'kmod-static-nodes.initd'
        'binfmt-sh.patch')
sha256sums=('91a01ca6d930a0688fb91338209985de57cac7aa2d37feddacb78fd3d95308e2'
            '5211012d0e1bdfc1a32113cee5a2eec3a2be4b3549f88216cdecbadd6ca46d81'
            '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c'
            '7de1e65f48ba31fc015cfb77be167b41aabdf0f20cb6617ecf3f4c3ca434c9e8'
            'a3fda2186e023ae60c0e0d3806ffeb95effe675acea03cdfd0bf30e8f1c188d4'
            'cb5bc649c2c9998300aff1e9862a9404b44e53178d153d68288603e99c5aaefe'
            '4170bcf3655ff6fb32b35fc592a4294a64d25df98d2f0f09f467689ed1ad54ea'
            '1f4cd15749ff89fd564e216ff0c1f9ff085e0200dba24d74e3de948f681bd80f'
            '3ecbe7761b92a123a5a3d395ec3d9e090b0dfba7910a5987b4a2298c20a7e571'
            '3680546deb196de39a2ea4f7a3b30977773be011cc1f0285e64015f41c18e853')

_args=(
    BRANDING='Parabola GNU/Linux-libre'
    SYSCONFDIR=/etc
    PREFIX=/usr
    SBINDIR=/usr/bin
    LIBEXECDIR=/usr/lib/rc
    MKSELINUX=no
    MKPAM=pam
    MKTERMCAP=ncurses
    MKSYSVINIT=yes
    MKBASHCOMP=yes
    MKZSHCOMP=yes
    MKPKGCONFIG=yes
)

prepare(){
    cd "${srcdir}/${pkgbase}-${pkgver}"
    sed -i 's:0444:0644:' mk/sys.mk
    patch -Np 1 -i ../binfmt-sh.patch

    # make bootmisc work with sysvinit too
    patch -RNp1 -i ../revert.patch
}

check(){
    cd "${srcdir}/${pkgbase}-${pkgver}"
    make -k check
}

build(){
    cd "${pkgbase}-${pkgver}"
    make "${_args[@]}"
}

package_openrc() {
    depends=('psmisc' 'pam' 'openrc-pid1')
    optdepends=('openrc-net: OpenRC ("newnet") network management scripts'
                'netifrc: Gentoo ("oldnet") network management scripts')
    backup=('etc/rc.conf'
            'etc/conf.d/agetty'
            'etc/conf.d/bootmisc'
            'etc/conf.d/consolefont'
            'etc/conf.d/devfs'
            'etc/conf.d/dmesg'
            'etc/conf.d/fsck'
            'etc/conf.d/hostname'
            'etc/conf.d/hwclock'
            'etc/conf.d/keymaps'
            'etc/conf.d/killprocs'
            'etc/conf.d/localmount'
            'etc/conf.d/modules'
            'etc/conf.d/mtab'
            'etc/conf.d/net-online'
            'etc/conf.d/netmount'
            'etc/conf.d/swap'
            'etc/conf.d/urandom')
    provides=('kmod-openrc')
    conflicts=('kmod-openrc' 'systemd-tools')
    replaces=('kmod-openrc')

    cd "${pkgbase}-${pkgver}"

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

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

    sed -e 's/#unicode="NO"/unicode="YES"/' \
        -e 's/#rc_logger="NO"/rc_logger="YES"/' \
        -e 's/#rc_controller_cgroups="YES"/rc_controller_cgroups="YES"/' \
        -e 's|#rc_shell=/bin/sh|rc_shell=/usr/bin/sulogin|' \
        -i "${pkgdir}/etc/rc.conf"

    install -d "${pkgdir}"/usr/lib/{openrc/cache,binfmt.d,sysctl.d}

    # getty
    sed -e 's|#baud=""|baud="38400"|' \
        -e 's|#term_type="linux"|term_type="linux"|' \
        -e 's|#agetty_options=""|agetty_options=""|' \
        -i ${pkgdir}/etc/conf.d/agetty

    # sysctl defaults
    install -m755 "${srcdir}"/sysctl.conf "${pkgdir}"/usr/lib/sysctl.d/50-default.conf

    # pacman hooks
    install -Dm755 "${srcdir}"/openrc-hook "${pkgdir}"/usr/share/libalpm/scripts/openrc-hook
    install -Dm644 -t "${pkgdir}"/usr/share/libalpm/hooks "${srcdir}"/*.hook

    # license
    install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgbase}"/LICENSE

    # split bash completions
    install -d "${srcdir}"/_bash-completion/usr/share/bash-completion/completions
    mv -v "${pkgdir}"/usr/share/bash-completion/completions/* "${srcdir}"/_bash-completion/usr/share/bash-completion/completions

    # split zsh completions
    install -d "${srcdir}"/_zsh/usr/share/zsh/site-functions
    mv -v "${pkgdir}"/usr/share/zsh/site-functions/* "${srcdir}"/_zsh/usr/share/zsh/site-functions

    # split init
    for file in \
      etc/init.d/agetty.tty{1..6} \
      etc/runlevels/default/agetty.tty{1..6} \
      {usr,usr/lib/rc}/bin/shutdown \
      {usr,usr/lib/rc}/bin/reboot \
      {usr,usr/lib/rc}/bin/halt \
      {usr,usr/lib/rc}/bin/poweroff \
      usr/bin/openrc-{init,shutdown} \
      usr/bin/init \
      usr/share/man/man8/openrc-{init,shutdown}.8
    do
        install -d "${srcdir}"/_init/"${file%/*}"
        mv -v "${pkgdir}"/"${file}" "${srcdir}"/_init/"${file}"
    done

    # split networking scripts
    for file in etc/{init,conf}.d/{network,staticroute}; do
        install -d "${srcdir}"/_net/"${file%/*}"
        mv -v "${pkgdir}"/"${file}" "${srcdir}"/_net/"${file}"
    done

    install -d "${srcdir}"/_init/etc/conf.d
    cp -v "${pkgdir}"/etc/conf.d/agetty "${srcdir}"/_init/etc/conf.d/agetty

    # kmod staticc nodes
    install -m755 "${srcdir}"/kmod-static-nodes.initd "${pkgdir}"/etc/init.d/kmod-static-nodes
    ln -snf /etc/init.d/kmod-static-nodes "${pkgdir}"/etc/runlevels/sysinit/kmod-static-nodes
}

package_openrc-bash-completions() {
    depends=('openrc' 'bash')
    pkgdesc="OpenRC completions for Bash"

    mv -v "${srcdir}"/_bash-completion/* "${pkgdir}"
}

package_openrc-zsh-completions() {
    depends=('openrc' 'zsh')
    pkgdesc="OpenRC completions for ZSH"

    mv -v "${srcdir}"/_zsh/* "${pkgdir}"
}

package_openrc-init() {
    pkgdesc="OpenRC alternative to sysvinit"
    depends=('openrc')
    provides=('openrc-pid1' 'init')
    conflicts=('openrc-pid1' 'init')
    backup=(etc/conf.d/agetty.tty{1..6})

    mv -v "${srcdir}"/_init/* "${pkgdir}"

    # license
    install -Dm644 "${pkgbase}-${pkgver}"/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE

    for num in {1..6}; do
        cp -v ${pkgdir}/etc/conf.d/agetty ${pkgdir}/etc/conf.d/agetty.tty$num
    done
    rm ${pkgdir}/etc/conf.d/agetty
}

package_openrc-sysvinit() {
    pkgdesc="OpenRC support for using sysvinit as PID 1"
    depends=('openrc' 'sysvinit')
    provides=('openrc-pid1' 'initscripts')
    conflicts=('openrc-pid1' 'initscripts')
    backup=('etc/inittab')

    cd "${pkgbase}-${pkgver}"

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

    install -Dm644 support/sysvinit/inittab "${pkgdir}"/etc/inittab
    install -Dm755 support/sysvinit/halt.sh "${pkgdir}"/usr/bin/halt.sh
    sed -i 's|/sbin|/usr/bin|g' "${pkgdir}"/etc/inittab "${pkgdir}"/usr/bin/halt.sh
}

package_openrc-net() {
    pkgdesc="OpenRC new-style networking"
    depends=('openrc')
    backup=('etc/conf.d/network'
            'etc/conf.d/staticroute')

    mv -v "${srcdir}"/_net/* "${pkgdir}"

    # license
    install -Dm644 "${pkgbase}-${pkgver}"/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
}