baselayout-prefix-2.2-r4.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. DESCRIPTION="Minimal baselayout for Gentoo Prefix installs"
  7. HOMEPAGE="https://www.gentoo.org/"
  8. SRC_URI="mirror://gentoo/${MY_P}.tar.bz2
  9. https://dev.gentoo.org/~vapier/dist/${MY_P}.tar.bz2"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. 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"
  13. RDEPEND="sys-apps/gentoo-functions"
  14. DEPEND="${RDEPEND}"
  15. pkg_preinst() {
  16. # This is written in src_install (so it's in CONTENTS), but punt all
  17. # pending updates to avoid user having to do etc-update (and make the
  18. # pkg_postinst logic simpler).
  19. rm -f "${EROOT}"/etc/._cfg????_gentoo-release
  20. }
  21. src_install() {
  22. # make functions.sh available in /etc/init.d (from gentoo-functions)
  23. # Note: we cannot replace the symlink with a file here, or Portage will
  24. # config-protect it, and etc-update can't handle symlink to file updates
  25. dodir etc/init.d
  26. dosym ../../lib/gentoo/functions.sh /etc/init.d/functions.sh
  27. pushd "${WORKDIR}"/${MY_P} > /dev/null || die
  28. dodir etc
  29. sed \
  30. -e "/PATH=/!s:/\(etc\|usr/bin\|bin\):\"${EPREFIX}\"/\1:g" \
  31. -e "/PATH=/s|\([:\"]\)/|\1${EPREFIX}/|g" \
  32. -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
  33. -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
  34. etc/profile > "${ED}"/etc/profile || die
  35. dodir etc/env.d
  36. sed \
  37. -e "s:/\(etc/env.d\|opt\|usr\):${EPREFIX}/\1:g" \
  38. -e "/^PATH=/s|\"$|:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"|" \
  39. etc/env.d/00basic > "${ED}"/etc/env.d/00basic || die
  40. dodoc ChangeLog.svn
  41. popd > /dev/null
  42. # add the host OS MANPATH
  43. if [[ -d "${ROOT}"/usr/share/man ]] ; then
  44. echo 'MANPATH="/usr/share/man"' > "${ED}"/etc/env.d/99basic || die
  45. fi
  46. # rc-scripts version for testing of features that *should* be present
  47. echo "Gentoo Prefix Base System release ${PV}" > "${ED}"/etc/gentoo-release
  48. # FHS compatibility symlinks stuff
  49. dosym /var/tmp /usr/tmp
  50. # add a dummy to avoid Portage shebang errors
  51. dodir sbin
  52. cat > "${ED}"/sbin/runscript <<- EOF
  53. #!/usr/bin/env sh
  54. source "${EPREFIX}/lib/gentoo/functions.sh"
  55. eerror "runscript not supported by Gentoo Prefix Base System release ${PV}" 1>&2
  56. exit 1
  57. EOF
  58. chmod 755 "${ED}"/sbin/runscript || die
  59. }
  60. pkg_postinst() {
  61. # Take care of the etc-update for the user
  62. if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then
  63. mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release
  64. fi
  65. # baselayout leaves behind a lot of .keep files, so let's clean them up
  66. find "${EROOT}"/lib/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
  67. find "${EROOT}"/lib/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
  68. }