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