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
46
47
48
49
50
51
52
53
54
55
56
57
58
|
diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
--- baselayout-1.12.5.orig/etc/profile 2009-12-09 13:48:07 +0100
+++ baselayout-1.12.5/etc/profile 2009-12-09 13:54:52 +0100
@@ -110,9 +110,34 @@
# it in the user's dot-files), but it shouldn't make any
# difference.
. "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
+ elif [ -n "${_ro_root}" ]; then
+ # We're in a prefix chain, but have no local bash. we rely on bash
+ # beeing there _somewhere_ in the chain, so we do not need to set
+ # PS1 explicitly.
+ if [ -z "${PS1}" ]; then
+ # try harder to find something in the parent prefix of the chain.
+ # dont bother to search multiple chain members up to the top.
+ if [ -f "${_ro_root}/etc/bash/bashrc" ]; then
+ . "${_ro_root}/etc/bash/bashrc"
+ fi
+ fi
else
PS1='\u@\h \w \$ '
fi
+
+ # Set the last dirpart of the current prefix somewhere
+ # in the prompt, so one immediately knows where he/she is.
+ if [ ${_ro_recursion_level} == 0 ]; then
+ # we're in the last prefix of the chain here.
+ _ro_name="@GENTOO_PORTAGE_EPREFIX@"
+ _ro_name="${_ro_name##*/}"
+
+ # use color only if the prompt already contains color escapes
+ case "${PS1}" in
+ *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;;
+ *) PS1="[${_ro_name}] ${PS1}" ;;
+ esac
+ fi
else
# Setup a bland default prompt. Since this prompt should be useable
# on color and non-color terminals, as well as shells that don't
@@ -120,6 +145,10 @@
PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
fi
+# when chaining prefixes, we want the prompt to be passed to the child too,
+# so we need to export it.
+export PS1
+
for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
if [ -r "$sh" ] ; then
. "$sh"
@@ -146,7 +175,7 @@
if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
fi
-elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" ]]; then
+elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then
echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
echo " Having EPREFIX set this way will probably render this environment unusable."
|