sysvinit-2.88-r9.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils toolchain-funcs flag-o-matic
  5. DESCRIPTION="/sbin/init - parent of all processes"
  6. HOMEPAGE="https://savannah.nongnu.org/projects/sysvinit"
  7. SRC_URI="mirror://nongnu/${PN}/${P}dsf.tar.bz2"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86"
  11. IUSE="selinux ibm static kernel_FreeBSD"
  12. CDEPEND="
  13. selinux? (
  14. >=sys-libs/libselinux-1.28
  15. )"
  16. DEPEND="${CDEPEND}
  17. virtual/os-headers"
  18. RDEPEND="${CDEPEND}
  19. selinux? ( sec-policy/selinux-shutdown )
  20. !<sys-apps/openrc-0.13
  21. "
  22. S=${WORKDIR}/${P}dsf
  23. PATCHES=(
  24. "${FILESDIR}/${PN}-2.86-kexec.patch" #80220
  25. "${FILESDIR}/${PN}-2.86-shutdown-single.patch" #158615
  26. "${FILESDIR}/${P}-makefile.patch" #319197
  27. "${FILESDIR}/${P}-selinux.patch" #326697
  28. "${FILESDIR}/${P}-shutdown-h.patch" #449354
  29. "${FILESDIR}/${PN}-2.88-sysmacros.patch"
  30. "${FILESDIR}/${PN}-2.88-ttydefaults.patch" #551626
  31. )
  32. src_prepare() {
  33. epatch "${PATCHES[@]}"
  34. sed -i '/^CPPFLAGS =$/d' src/Makefile || die
  35. # last/lastb/mesg/mountpoint/sulogin/utmpdump/wall have moved to util-linux
  36. sed -i -r \
  37. -e '/^(USR)?S?BIN/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)\>::g' \
  38. -e '/^MAN[18]/s:\<(last|lastb|mesg|mountpoint|sulogin|utmpdump|wall)[.][18]\>::g' \
  39. src/Makefile || die
  40. # pidof has moved to >=procps-3.3.9
  41. sed -i -r \
  42. -e '/\/bin\/pidof/d' \
  43. -e '/^MAN8/s:\<pidof.8\>::g' \
  44. src/Makefile || die
  45. # Mung inittab for specific architectures
  46. cd "${WORKDIR}"
  47. cp "${FILESDIR}"/inittab-2.88 inittab || die "cp inittab"
  48. local insert=()
  49. use ppc && insert=( '#psc0:12345:respawn:/sbin/agetty 115200 ttyPSC0 linux' )
  50. use arm && insert=( '#f0:12345:respawn:/sbin/agetty 9600 ttyFB0 vt100' )
  51. use arm64 && insert=( 'f0:12345:respawn:/sbin/agetty 9600 ttyAMA0 vt100' )
  52. use hppa && insert=( 'b0:12345:respawn:/sbin/agetty 9600 ttyB0 vt100' )
  53. use s390 && insert=( 's0:12345:respawn:/sbin/agetty 38400 console dumb' )
  54. if use ibm ; then
  55. insert+=(
  56. '#hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0'
  57. '#hvsi:2345:respawn:/sbin/agetty -L 19200 hvsi0'
  58. )
  59. fi
  60. (use arm || use mips || use sh || use sparc) && sed -i '/ttyS0/s:#::' inittab
  61. if use kernel_FreeBSD ; then
  62. sed -i \
  63. -e 's/linux/cons25/g' \
  64. -e 's/ttyS0/cuaa0/g' \
  65. -e 's/ttyS1/cuaa1/g' \
  66. inittab #121786
  67. fi
  68. if use x86 || use amd64 ; then
  69. sed -i \
  70. -e '/ttyS[01]/s:9600:115200:' \
  71. inittab
  72. fi
  73. if [[ ${#insert[@]} -gt 0 ]] ; then
  74. printf '%s\n' '' '# Architecture specific features' "${insert[@]}" >> inittab
  75. fi
  76. }
  77. src_compile() {
  78. local myconf
  79. tc-export CC
  80. append-lfs-flags
  81. export DISTRO= #381311
  82. use static && append-ldflags -static
  83. use selinux && myconf=WITH_SELINUX=yes
  84. emake -C src ${myconf} || die
  85. }
  86. src_install() {
  87. emake -C src install ROOT="${D}"
  88. dodoc README doc/*
  89. insinto /etc
  90. doins "${WORKDIR}"/inittab
  91. # dead symlink
  92. rm "${D}"/usr/bin/lastb || die
  93. }
  94. pkg_postinst() {
  95. # Reload init to fix unmounting problems of / on next reboot.
  96. # This is really needed, as without the new version of init cause init
  97. # not to quit properly on reboot, and causes a fsck of / on next reboot.
  98. if [[ ${ROOT} == / ]] ; then
  99. # Do not return an error if this fails
  100. /sbin/telinit U &>/dev/null
  101. fi
  102. elog "The last/lastb/mesg/mountpoint/sulogin/utmpdump/wall tools have been moved to"
  103. elog "sys-apps/util-linux. The pidof tool has been moved to sys-process/procps."
  104. }