PKGBUILD 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  2. # Maintainer: David P. <megver83@parabola.nu>
  3. # Contributor: Luke Shumaker <lukeshu@parabola.nu>
  4. # Maintainer (Artix): artoo <artoo@artixlinux.org>
  5. # Maintainer (Artix): Chris Cromer <cromer@artixlinux.org>
  6. # Contributor (Artix): williamh <williamh@gentoo.org>
  7. pkgbase=openrc
  8. pkgname=('openrc' 'openrc-bash-completions' 'openrc-zsh-completions'
  9. 'openrc-init' 'openrc-sysvinit' 'openrc-net')
  10. pkgver=0.42.1
  11. pkgrel=7
  12. pkgdesc="Gentoo's universal init system"
  13. arch=('x86_64' 'i686' 'armv7h')
  14. url="https://github.com/OpenRC/openrc"
  15. license=('BSD2')
  16. source=("${pkgbase}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz"
  17. "revert.patch::${url}/commit/1801561c2d36c330df7fd02c7508f503a61ff5ba.patch"
  18. "${pkgbase}.logrotate"
  19. 'openrc-hook'
  20. '30-openrc-upgrade.hook'
  21. '30-sysctl.hook'
  22. 'sysctl.conf'
  23. '30-binfmt.hook'
  24. 'kmod-static-nodes.initd'
  25. gcc-10-fix.patch::${url}/commit/375ef42393f3dc6edbaa2cb70c79b2366072db38.patch
  26. supervise-daemon-fix.patch::${url}/commit/6deda13754f1b60245945e953cce8d97e40e86fc.patch
  27. openrc-shutdown-fix.patch::${url}/commit/fd852865e06a74ecf8b77ff534fa8053e020160f.patch
  28. posix-compliant-grep.patch::${url}/commit/a7e7fd2b37a7666f26c2d4de9386b2d04f583b41.patch
  29. binfmt-fix.patch::${url}/commit/eb610859519292c6164c4ba601d22e642c306beb.patch
  30. cgroup2-verify.patch::${url}/commit/87cfad3d6cd619c6090e8209092448ae68279b0c.patch)
  31. sha256sums=('91a01ca6d930a0688fb91338209985de57cac7aa2d37feddacb78fd3d95308e2'
  32. '5211012d0e1bdfc1a32113cee5a2eec3a2be4b3549f88216cdecbadd6ca46d81'
  33. '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c'
  34. '7de1e65f48ba31fc015cfb77be167b41aabdf0f20cb6617ecf3f4c3ca434c9e8'
  35. 'a3fda2186e023ae60c0e0d3806ffeb95effe675acea03cdfd0bf30e8f1c188d4'
  36. '28ec075d30096bd54499e994f76f8526460474f1e4c33607045c1a71b0684263'
  37. '860d5b9ae60e13633bd94023c222fa1ef918a02db3ce2e3255cdd6bb9eef047e'
  38. '28aa413fd78bca98bb23294eeb3f49149825a2c2f97a7ee10039385f5e8e50e9'
  39. '3ecbe7761b92a123a5a3d395ec3d9e090b0dfba7910a5987b4a2298c20a7e571'
  40. 'addb1bf115b811fba3d120f5c68535ec07f32a55e570b661f1e5575f74327bac'
  41. '654dada5ffe56d6ae10d0ea4f9cb62c8c6c39a5398cd02561419a8bbf3f686b7'
  42. '5576a8b6c9fbe79ede027ed053f922da60d1cbe818803677f5aa5532f98ffac4'
  43. '46f6e809aabb629212a739af7f5177930e9c4a7f2adfdfc59911d778d3716ec9'
  44. '7e5d7dc888327ef99637fa7207ac9470d72cc37198ddd7ba2cdf72d10a1c7031'
  45. '41c6598da76bcdcdc8d9349f559bc6b587a6f6dec55bf7c79669af2b28af43e1')
  46. _args=(
  47. BRANDING='Parabola GNU/Linux-libre'
  48. SYSCONFDIR=/etc
  49. PREFIX=/usr
  50. SBINDIR=/usr/bin
  51. LIBEXECDIR=/usr/lib/rc
  52. MKSELINUX=no
  53. MKPAM=pam
  54. MKTERMCAP=ncurses
  55. MKSYSVINIT=yes
  56. MKBASHCOMP=yes
  57. MKZSHCOMP=yes
  58. MKPKGCONFIG=yes
  59. )
  60. prepare(){
  61. cd "${srcdir}/${pkgbase}-${pkgver}"
  62. sed -i 's:0444:0644:' mk/sys.mk
  63. patch -Np 1 -i ../gcc-10-fix.patch
  64. patch -Np 1 -i ../supervise-daemon-fix.patch
  65. patch -Np 1 -i ../openrc-shutdown-fix.patch
  66. patch -Np 1 -i ../posix-compliant-grep.patch
  67. patch -Np 1 -i ../binfmt-fix.patch
  68. patch -Np 1 -i ../cgroup2-verify.patch
  69. # make bootmisc work with sysvinit too
  70. patch -RNp1 -i ../revert.patch
  71. }
  72. check(){
  73. cd "${srcdir}/${pkgbase}-${pkgver}"
  74. make -k check
  75. }
  76. build(){
  77. cd "${pkgbase}-${pkgver}"
  78. make "${_args[@]}"
  79. }
  80. package_openrc() {
  81. depends=('psmisc' 'pam' 'openrc-pid1')
  82. optdepends=('openrc-net: OpenRC ("newnet") network management scripts'
  83. 'netifrc: Gentoo ("oldnet") network management scripts')
  84. backup=('etc/rc.conf'
  85. 'etc/conf.d/agetty'
  86. 'etc/conf.d/bootmisc'
  87. 'etc/conf.d/consolefont'
  88. 'etc/conf.d/devfs'
  89. 'etc/conf.d/dmesg'
  90. 'etc/conf.d/fsck'
  91. 'etc/conf.d/hostname'
  92. 'etc/conf.d/hwclock'
  93. 'etc/conf.d/keymaps'
  94. 'etc/conf.d/killprocs'
  95. 'etc/conf.d/localmount'
  96. 'etc/conf.d/modules'
  97. 'etc/conf.d/mtab'
  98. 'etc/conf.d/net-online'
  99. 'etc/conf.d/netmount'
  100. 'etc/conf.d/swap'
  101. 'etc/conf.d/urandom')
  102. provides=('kmod-openrc')
  103. conflicts=('kmod-openrc' 'systemd-tools')
  104. replaces=('kmod-openrc')
  105. cd "${pkgbase}-${pkgver}"
  106. make DESTDIR="${pkgdir}" "${_args[@]}" install
  107. install -Dm644 "${srcdir}/${pkgbase}".logrotate "${pkgdir}"/etc/logrotate.d/"${pkgbase}"
  108. sed -e 's/#unicode="NO"/unicode="YES"/' \
  109. -e 's/#rc_logger="NO"/rc_logger="YES"/' \
  110. -e 's/#rc_controller_cgroups="YES"/rc_controller_cgroups="YES"/' \
  111. -e 's|#rc_shell=/bin/sh|rc_shell=/usr/bin/sulogin|' \
  112. -i "${pkgdir}/etc/rc.conf"
  113. install -d "${pkgdir}"/usr/lib/{openrc/cache,binfmt.d,sysctl.d}
  114. # getty
  115. sed -e 's|#baud=""|baud="38400"|' \
  116. -e 's|#term_type="linux"|term_type="linux"|' \
  117. -e 's|#agetty_options=""|agetty_options=""|' \
  118. -i ${pkgdir}/etc/conf.d/agetty
  119. # sysctl defaults
  120. # upstream (systemd) default configuration can be found on github:
  121. # https://raw.githubusercontent.com/systemd/systemd/master/sysctl.d/50-default.conf
  122. install -m755 "${srcdir}"/sysctl.conf "${pkgdir}"/usr/lib/sysctl.d/50-default.conf
  123. # pacman hooks
  124. install -Dm755 "${srcdir}"/openrc-hook "${pkgdir}"/usr/share/libalpm/scripts/openrc-hook
  125. install -Dm644 -t "${pkgdir}"/usr/share/libalpm/hooks "${srcdir}"/*.hook
  126. # license
  127. install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgbase}"/LICENSE
  128. # split bash completions
  129. install -d "${srcdir}"/_bash-completion/usr/share/bash-completion/completions
  130. mv -v "${pkgdir}"/usr/share/bash-completion/completions/* "${srcdir}"/_bash-completion/usr/share/bash-completion/completions
  131. # split zsh completions
  132. install -d "${srcdir}"/_zsh/usr/share/zsh/site-functions
  133. mv -v "${pkgdir}"/usr/share/zsh/site-functions/* "${srcdir}"/_zsh/usr/share/zsh/site-functions
  134. # split init
  135. for file in \
  136. etc/init.d/agetty.tty{1..6} \
  137. etc/runlevels/default/agetty.tty{1..6} \
  138. {usr,usr/lib/rc}/bin/shutdown \
  139. {usr,usr/lib/rc}/bin/reboot \
  140. {usr,usr/lib/rc}/bin/halt \
  141. {usr,usr/lib/rc}/bin/poweroff \
  142. usr/bin/openrc-{init,shutdown} \
  143. usr/bin/init \
  144. usr/share/man/man8/openrc-{init,shutdown}.8
  145. do
  146. install -d "${srcdir}"/_init/"${file%/*}"
  147. mv -v "${pkgdir}"/"${file}" "${srcdir}"/_init/"${file}"
  148. done
  149. # split networking scripts
  150. for file in etc/{init,conf}.d/{network,staticroute}; do
  151. install -d "${srcdir}"/_net/"${file%/*}"
  152. mv -v "${pkgdir}"/"${file}" "${srcdir}"/_net/"${file}"
  153. done
  154. install -d "${srcdir}"/_init/etc/conf.d
  155. cp -v "${pkgdir}"/etc/conf.d/agetty "${srcdir}"/_init/etc/conf.d/agetty
  156. # kmod staticc nodes
  157. install -m755 "${srcdir}"/kmod-static-nodes.initd "${pkgdir}"/etc/init.d/kmod-static-nodes
  158. ln -snf /etc/init.d/kmod-static-nodes "${pkgdir}"/etc/runlevels/sysinit/kmod-static-nodes
  159. # do not enable hwclock by default since our kernels handle the system time
  160. # https://wiki.gentoo.org/wiki/System_time#OpenRC_2
  161. rm "${pkgdir}"/etc/runlevels/boot/hwclock
  162. }
  163. package_openrc-bash-completions() {
  164. depends=('openrc' 'bash')
  165. pkgdesc="OpenRC completions for Bash"
  166. mv -v "${srcdir}"/_bash-completion/* "${pkgdir}"
  167. }
  168. package_openrc-zsh-completions() {
  169. depends=('openrc' 'zsh')
  170. pkgdesc="OpenRC completions for ZSH"
  171. mv -v "${srcdir}"/_zsh/* "${pkgdir}"
  172. }
  173. package_openrc-init() {
  174. pkgdesc="OpenRC alternative to sysvinit"
  175. depends=('openrc')
  176. provides=('openrc-pid1' 'init')
  177. conflicts=('openrc-pid1' 'init')
  178. backup=(etc/conf.d/agetty.tty{1..6})
  179. mv -v "${srcdir}"/_init/* "${pkgdir}"
  180. # license
  181. install -Dm644 "${pkgbase}-${pkgver}"/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
  182. for num in {1..6}; do
  183. cp -v ${pkgdir}/etc/conf.d/agetty ${pkgdir}/etc/conf.d/agetty.tty$num
  184. done
  185. rm ${pkgdir}/etc/conf.d/agetty
  186. }
  187. package_openrc-sysvinit() {
  188. pkgdesc="OpenRC support for using sysvinit as PID 1"
  189. depends=('openrc' 'sysvinit')
  190. provides=('openrc-pid1' 'initscripts')
  191. conflicts=('openrc-pid1' 'initscripts')
  192. backup=('etc/inittab')
  193. cd "${pkgbase}-${pkgver}"
  194. # license
  195. install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
  196. install -Dm644 support/sysvinit/inittab "${pkgdir}"/etc/inittab
  197. install -Dm755 support/sysvinit/halt.sh "${pkgdir}"/usr/bin/halt.sh
  198. sed -i 's|/sbin|/usr/bin|g' "${pkgdir}"/etc/inittab "${pkgdir}"/usr/bin/halt.sh
  199. }
  200. package_openrc-net() {
  201. pkgdesc="OpenRC new-style networking"
  202. depends=('openrc')
  203. backup=('etc/conf.d/network'
  204. 'etc/conf.d/staticroute')
  205. mv -v "${srcdir}"/_net/* "${pkgdir}"
  206. # license
  207. install -Dm644 "${pkgbase}-${pkgver}"/LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
  208. }