baselayout-prefix-2.2-r3.ebuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=3
  4. inherit eutils multilib libtool
  5. MY_P=${P/-prefix/} # just use "upstream" sources
  6. EINFO=einfo-1.0.6
  7. DESCRIPTION="Minimal baselayout and e-functions for Gentoo Prefix installs"
  8. HOMEPAGE="https://www.gentoo.org/"
  9. SRC_URI="mirror://gentoo/${MY_P}.tar.bz2
  10. https://dev.gentoo.org/~vapier/dist/${MY_P}.tar.bz2
  11. https://dev.gentoo.org/~redlizard/distfiles/${EINFO}.tar.xz"
  12. LICENSE="GPL-2"
  13. SLOT="0"
  14. KEYWORDS="~arm ~ppc-aix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
  15. IUSE="build kernel_linux"
  16. S=${WORKDIR}/${EINFO}
  17. pkg_preinst() {
  18. # This is written in src_install (so it's in CONTENTS), but punt all
  19. # pending updates to avoid user having to do etc-update (and make the
  20. # pkg_postinst logic simpler).
  21. rm -f "${EROOT}"/etc/._cfg????_gentoo-release
  22. }
  23. src_prepare() {
  24. # exotic platforms still aren't fixed in upstream libtool
  25. elibtoolize
  26. }
  27. src_configure() {
  28. econf --libexecdir="${EPREFIX}/usr/lib/einfo"
  29. }
  30. src_install() {
  31. emake DESTDIR="${D}" install || die
  32. # make functions.sh available in /etc/init.d
  33. # Note: we cannot replace the symlink with a file here, or Portage will
  34. # config-protect it, and etc-update can't handle symlink to file updates
  35. dodir etc/init.d
  36. dosym ../../usr/lib/einfo/sh/functions.sh /etc/init.d/functions.sh
  37. pushd "${WORKDIR}"/${MY_P} > /dev/null || die
  38. dodir etc
  39. sed \
  40. -e "/PATH=/!s:/\(etc\|usr/bin\|bin\):\"${EPREFIX}\"/\1:g" \
  41. -e "/PATH=/s|\([:\"]\)/|\1${EPREFIX}/|g" \
  42. -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
  43. -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
  44. etc/profile > "${ED}"/etc/profile || die
  45. dodir etc/env.d
  46. sed \
  47. -e "s:/\(etc/env.d\|opt\|usr\):${EPREFIX}/\1:g" \
  48. -e "/^PATH=/s|\"$|:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"|" \
  49. etc/env.d/00basic > "${ED}"/etc/env.d/00basic || die
  50. dodoc ChangeLog.svn
  51. popd > /dev/null
  52. # add the host OS MANPATH
  53. if [[ -d "${ROOT}"/usr/share/man ]] ; then
  54. echo 'MANPATH="/usr/share/man"' > "${ED}"/etc/env.d/99basic || die
  55. fi
  56. # rc-scripts version for testing of features that *should* be present
  57. echo "Gentoo Prefix Base System release ${PV}" > "${ED}"/etc/gentoo-release
  58. # FHS compatibility symlinks stuff
  59. dosym /var/tmp /usr/tmp
  60. # add a dummy to avoid Portage shebang errors
  61. dodir sbin
  62. cat > "${ED}"/sbin/runscript <<- EOF
  63. #!/bin/sh
  64. echo "runscript not supported by Gentoo Prefix Base System release ${PV}" 1>&2
  65. exit 1
  66. EOF
  67. chmod 755 "${ED}"/sbin/runscript || die
  68. }
  69. pkg_postinst() {
  70. # Take care of the etc-update for the user
  71. if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then
  72. mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release
  73. fi
  74. # baselayout leaves behind a lot of .keep files, so let's clean them up
  75. find "${EROOT}"/lib/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
  76. find "${EROOT}"/lib/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
  77. }