logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

openrc-0.41.2-r1.ebuild (6274B)


  1. # Copyright 1999-2019 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit flag-o-matic pam toolchain-funcs
  5. DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
  6. HOMEPAGE="https://github.com/openrc/openrc/"
  7. if [[ ${PV} == "9999" ]]; then
  8. EGIT_REPO_URI="https://github.com/OpenRC/${PN}.git"
  9. inherit git-r3
  10. else
  11. SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
  12. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 "
  13. fi
  14. LICENSE="BSD-2"
  15. SLOT="0"
  16. IUSE="audit bash debug init ncurses pam newnet prefix +netifrc selinux
  17. static-libs unicode kernel_linux kernel_FreeBSD"
  18. COMMON_DEPEND="kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
  19. ncurses? ( sys-libs/ncurses:0= )
  20. pam? (
  21. sys-auth/pambase
  22. sys-libs/pam
  23. )
  24. audit? ( sys-process/audit )
  25. kernel_linux? (
  26. sys-process/psmisc
  27. !<sys-process/procps-3.3.9-r2
  28. )
  29. selinux? (
  30. sys-apps/policycoreutils
  31. >=sys-libs/libselinux-2.6
  32. )
  33. !<sys-apps/baselayout-2.1-r1
  34. !<sys-fs/udev-init-scripts-27"
  35. DEPEND="${COMMON_DEPEND}
  36. virtual/os-headers
  37. ncurses? ( virtual/pkgconfig )"
  38. RDEPEND="${COMMON_DEPEND}
  39. bash? ( app-shells/bash )
  40. !prefix? (
  41. kernel_linux? (
  42. !init? ( >=sys-apps/sysvinit-2.86-r6[selinux?] )
  43. init? ( !sys-apps/sysvinit )
  44. virtual/tmpfiles
  45. )
  46. kernel_FreeBSD? ( sys-freebsd/freebsd-sbin )
  47. )
  48. selinux? (
  49. >=sec-policy/selinux-base-policy-2.20170204-r4
  50. >=sec-policy/selinux-openrc-2.20170204-r4
  51. )
  52. !<app-shells/gentoo-bashcomp-20180302
  53. !<app-shells/gentoo-zsh-completions-20180228
  54. "
  55. PDEPEND="netifrc? ( net-misc/netifrc )"
  56. src_prepare() {
  57. default
  58. if [[ ${PV} == "9999" ]] ; then
  59. local ver="git-${EGIT_VERSION:0:6}"
  60. sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/gitver.mk || die
  61. fi
  62. }
  63. src_compile() {
  64. unset LIBDIR #266688
  65. MAKE_ARGS="${MAKE_ARGS}
  66. LIBNAME=$(get_libdir)
  67. LIBEXECDIR=${EPREFIX}/lib/rc
  68. MKBASHCOMP=yes
  69. MKNET=$(usex newnet)
  70. MKSELINUX=$(usex selinux)
  71. MKAUDIT=$(usex audit)
  72. MKPAM=$(usev pam)
  73. MKSTATICLIBS=$(usex static-libs)
  74. MKSYSVINIT=$(usex init)
  75. MKZSHCOMP=yes
  76. SH=$(usex bash /bin/bash /bin/sh)"
  77. local brand="Unknown"
  78. if use kernel_linux ; then
  79. MAKE_ARGS="${MAKE_ARGS} OS=Linux"
  80. brand="Linux"
  81. elif use kernel_FreeBSD ; then
  82. MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
  83. brand="FreeBSD"
  84. fi
  85. export BRANDING="Gentoo ${brand}"
  86. use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
  87. export DEBUG=$(usev debug)
  88. export MKTERMCAP=$(usev ncurses)
  89. tc-export CC AR RANLIB
  90. emake ${MAKE_ARGS}
  91. }
  92. # set_config <file> <option name> <yes value> <no value> test
  93. # a value of "#" will just comment out the option
  94. set_config() {
  95. local file="${ED}/$1" var=$2 val com
  96. eval "${@:5}" && val=$3 || val=$4
  97. [[ ${val} == "#" ]] && com="#" && val='\2'
  98. sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
  99. }
  100. set_config_yes_no() {
  101. set_config "$1" "$2" YES NO "${@:3}"
  102. }
  103. src_install() {
  104. emake ${MAKE_ARGS} DESTDIR="${D}" install
  105. # move the shared libs back to /usr so ldscript can install
  106. # more of a minimal set of files
  107. # disabled for now due to #270646
  108. #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
  109. #gen_usr_ldscript -a einfo rc
  110. gen_usr_ldscript libeinfo.so
  111. gen_usr_ldscript librc.so
  112. if ! use kernel_linux; then
  113. keepdir /lib/rc/init.d
  114. fi
  115. keepdir /lib/rc/tmp
  116. # Setup unicode defaults for silly unicode users
  117. set_config_yes_no /etc/rc.conf unicode use unicode
  118. # Cater to the norm
  119. set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
  120. # On HPPA, do not run consolefont by default (bug #222889)
  121. if use hppa; then
  122. rm -f "${ED}"/etc/runlevels/boot/consolefont
  123. fi
  124. # Support for logfile rotation
  125. insinto /etc/logrotate.d
  126. newins "${FILESDIR}"/openrc.logrotate openrc
  127. # install gentoo pam.d files
  128. newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
  129. newpamd "${FILESDIR}"/start-stop-daemon.pam supervise-daemon
  130. # install documentation
  131. dodoc ChangeLog *.md
  132. if use newnet; then
  133. dodoc README.newnet
  134. fi
  135. # start all the tty at boot except tty1 to not conflict with OpenRC output
  136. if use init; then
  137. for n in 2 3 4 5 6; do
  138. dosym "/etc/init.d/agetty" "/etc/init.d/agetty.tty${n}"
  139. dosym "/etc/init.d/agetty.tty${n}" "/etc/runlevel/boot/agetty.tty${n}"
  140. done
  141. # I like to keep a tty for OpenRC
  142. #dosym "/etc/init.d/agetty" "${ED}/etc/init.d/agetty.1"
  143. #dosym "/etc/init.d/agetty.1" "/etc/runlevel/default/agetty.1"
  144. fi
  145. }
  146. pkg_preinst() {
  147. # avoid default thrashing in conf.d files when possible #295406
  148. if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
  149. (
  150. unset hostname HOSTNAME
  151. source "${EROOT}"etc/conf.d/hostname
  152. : ${hostname:=${HOSTNAME}}
  153. [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
  154. )
  155. fi
  156. # set default interactive shell to sulogin if it exists
  157. set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
  158. return 0
  159. }
  160. pkg_postinst() {
  161. if use hppa; then
  162. elog "Setting the console font does not work on all HPPA consoles."
  163. elog "You can still enable it by running:"
  164. elog "# rc-update add consolefont boot"
  165. fi
  166. # Added for 0.35.
  167. if use kernel_linux && [[ ! -h "${EROOT}"/lib ]]; then
  168. if [[ -d "${EROOT}$(get_libdir)"/rc ]]; then
  169. cp -RPp "${EROOT}$(get_libdir)/rc" "${EROOT}"lib
  170. fi
  171. elif ! use kernel_linux; then
  172. if [[ -d "${EROOT}$(get_libdir)"/rc ]]; then
  173. cp -RPp "${EROOT}$(get_libdir)/rc" "${EROOT}"lib
  174. fi
  175. fi
  176. if ! use newnet && ! use netifrc; then
  177. ewarn "You have emerged OpenRc without network support. This"
  178. ewarn "means you need to SET UP a network manager such as"
  179. ewarn " net-misc/netifrc, net-misc/dhcpcd, net-misc/wicd,"
  180. ewarn "net-misc/NetworkManager, or net-vpn/badvpn."
  181. ewarn "Or, you have the option of emerging openrc with the newnet"
  182. ewarn "use flag and configuring /etc/conf.d/network and"
  183. ewarn "/etc/conf.d/staticroute if you only use static interfaces."
  184. ewarn
  185. fi
  186. if use newnet && [ ! -e "${EROOT}"etc/runlevels/boot/network ]; then
  187. ewarn "Please add the network service to your boot runlevel"
  188. ewarn "as soon as possible. Not doing so could leave you with a system"
  189. ewarn "without networking."
  190. ewarn
  191. fi
  192. }