summaryrefslogtreecommitdiff
blob: 3882ffe14a9ce8fd4b22ac6c22f806ca781e5d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash

if [[ -r "@GENTOO_PORTAGE_EPREFIX@"/lib/gentoo/functions.sh ]]; then
	. "@GENTOO_PORTAGE_EPREFIX@"/lib/gentoo/functions.sh
elif [[ -r "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh ]]; then
	. "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh
elif [[ -r "@GENTOO_PORTAGE_EPREFIX@"/sbin/functions.sh ]]; then
	. "@GENTOO_PORTAGE_EPREFIX@"/sbin/functions.sh
fi

einfo "entering chained prefix @GENTOO_PORTAGE_EPREFIX@ ..."

# inform profiles very early of us beeing interactive (or at least,
# we will _start_ an interactive shell, so we want the according bits.)
set -i

. "@GENTOO_PORTAGE_EPREFIX@"/etc/profile

# if there is no local portage, foreign portage instances need to know 
# where to merge to - and thus we need to set EPREFIX.
# the other way round, if there is a local portage, EPREFIX may not
# point anywhere else than to our local EPREFIX or be unset...

# DISABLED: this is done by etc/profile now, to be able to start a
#           prefix environment by sourcing etc/profile.

#if [[ -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
#	if [[ -n "${EPREFIX}" ]] && [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" ]]; then
#		ewarn "EPREFIX is set. this will render portage unusable, unsetting"
#		unset EPREFIX
#	fi
#else
#	export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
#fi

# a common problem: the child has no less installed, but baselayout insists
# on setting PAGER to EPREFIX/usr/bin/less. everything gets back to normal
# when unsetting PAGER in this case.
if [[ ! -x "${PAGER}" ]]; then
	unset PAGER
fi

bash --noprofile
einfo "leaving chained prefix @GENTOO_PORTAGE_EPREFIX@ ..."