Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-alt r1705 - in trunk/baselayout-prefix: . etc sbin
Date: Thu, 28 Apr 2011 18:42:11
Message-Id: 20110428184201.A0B7C20054@flycatcher.gentoo.org
1 Author: grobian
2 Date: 2011-04-28 18:42:00 +0000 (Thu, 28 Apr 2011)
3 New Revision: 1705
4
5 Added:
6 trunk/baselayout-prefix/baselayout-1.12.14-prefix-chaining.patch
7 Removed:
8 trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch
9 Modified:
10 trunk/baselayout-prefix/etc/profile
11 trunk/baselayout-prefix/sbin/runscript.sh
12 Log:
13 update prefix-chaining patch
14
15 Copied: trunk/baselayout-prefix/baselayout-1.12.14-prefix-chaining.patch (from rev 1704, trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch)
16 ===================================================================
17 --- trunk/baselayout-prefix/baselayout-1.12.14-prefix-chaining.patch (rev 0)
18 +++ trunk/baselayout-prefix/baselayout-1.12.14-prefix-chaining.patch 2011-04-28 18:42:00 UTC (rev 1705)
19 @@ -0,0 +1,181 @@
20 +# HG changeset patch
21 +# User Fabian Groffen <grobian@g.o>
22 +# Date 1304015894 -7200
23 +# Node ID 0498f0edbf9fed030f8aecde43292865b1dccbb7
24 +# Parent 3eab7cc2a551070ed321abce663e8fc5d311949c
25 +imported patch baselayout-1.12.5-prefix-chaining.patch
26 +
27 +diff -r 3eab7cc2a551 -r 0498f0edbf9f baselayout-prefix/etc/profile
28 +--- a/baselayout-prefix/etc/profile Thu Apr 28 18:25:46 2011 +0000
29 ++++ b/baselayout-prefix/etc/profile Thu Apr 28 20:38:14 2011 +0200
30 +@@ -4,6 +4,62 @@
31 + # environment for login shells.
32 + #
33 +
34 ++#
35 ++# for prefix-chaining, the very first thing to do is to load
36 ++# the profiles for all chained instances above.
37 ++#
38 ++# TODO: is it safe in any case to shell source make.conf?
39 ++# don't do any recursive expansion here. if the parent can
40 ++# use READONLY_EPREFIX's, it has to have the same profile as
41 ++# we have here, and thus it will source parents before
42 ++# evaluating anything from itself.
43 ++#
44 ++_ro_root=$(. "@GENTOO_PORTAGE_EPREFIX@"/etc/make.conf && echo $READONLY_EPREFIX)
45 ++_ro_deps=${_ro_root#*:}
46 ++_ro_root=${_ro_root%:*}
47 ++
48 ++#
49 ++# prevent dooming of _ro_* variables by recursing down the
50 ++# profile chain, by backing the up, tagged by resursion depth.
51 ++#
52 ++
53 ++[[ -z "${_ro_recursion_level}" ]] && _ro_recursion_level=0
54 ++((++_ro_recursion_level))
55 ++
56 ++for _ro_backup_var in _ro_root _ro_deps; do
57 ++ eval "_ro_b${_ro_recursion_level}_${_ro_backup_var}=\${${_ro_backup_var}}"
58 ++done
59 ++
60 ++if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then
61 ++ . "${_ro_root}"/etc/profile
62 ++fi
63 ++
64 ++for _ro_backup_var in _ro_root _ro_deps; do
65 ++ eval "${_ro_backup_var}=\${_ro_b${_ro_recursion_level}_${_ro_backup_var}}"
66 ++done
67 ++
68 ++((--_ro_recursion_level))
69 ++
70 ++#
71 ++# With prefix-chaining we want another set of variables that
72 ++# should be retained for all prefixes. for example it is ok
73 ++# to retain PKG_CONFIG_PATH if the parent of the chain can
74 ++# be used to resolve RDEPEND...
75 ++#
76 ++if [[ -n "${_ro_root}" ]]; then
77 ++ _ro_chained_path_vars="PATH MANPATH"
78 ++
79 ++ if [[ ${_ro_deps} == *RDEPEND* ]]; then
80 ++ _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
81 ++ else
82 ++ unset PKG_CONFIG_PATH
83 ++ fi
84 ++
85 ++ for var in ${_ro_chained_path_vars}; do
86 ++ eval "_ro_backupenv_paths_${var}=\${${var}}"
87 ++ done
88 ++fi
89 ++
90 + # Load environment settings from profile.env, which is created by
91 + # env-update from the files in /etc/env.d
92 + if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then
93 +@@ -21,10 +77,17 @@
94 + # It is intentional in the following line to use || instead of -o.
95 + # This way the evaluation can be short-circuited and calling whoami is
96 + # avoided.
97 ++#
98 ++# system directories are only appended if this prefix is the last
99 ++# one in a chain of prefixes (or the only prefix in the chain), so
100 ++# that they don't end up in the middle of multiple different prefix
101 ++# paths (profile is recursive now, see above!)
102 + if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
103 +- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin"
104 ++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}"
105 ++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
106 + else
107 +- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin"
108 ++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}"
109 ++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/bin:/bin"
110 + fi
111 + export PATH
112 + unset ROOTPATH
113 +@@ -47,9 +110,34 @@
114 + # it in the user's dot-files), but it shouldn't make any
115 + # difference.
116 + . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
117 ++ elif [ -n "${_ro_root}" ]; then
118 ++ # We're in a prefix chain, but have no local bash. we rely on bash
119 ++ # beeing there _somewhere_ in the chain, so we do not need to set
120 ++ # PS1 explicitly.
121 ++ if [ -z "${PS1}" ]; then
122 ++ # try harder to find something in the parent prefix of the chain.
123 ++ # dont bother to search multiple chain members up to the top.
124 ++ if [ -f "${_ro_root}/etc/bash/bashrc" ]; then
125 ++ . "${_ro_root}/etc/bash/bashrc"
126 ++ fi
127 ++ fi
128 + else
129 + PS1='\u@\h \w \$ '
130 + fi
131 ++
132 ++ # Set the last dirpart of the current prefix somewhere
133 ++ # in the prompt, so one immediately knows where he/she is.
134 ++ if [ ${_ro_recursion_level} == 0 ]; then
135 ++ # we're in the last prefix of the chain here.
136 ++ _ro_name="@GENTOO_PORTAGE_EPREFIX@"
137 ++ _ro_name="${_ro_name##*/}"
138 ++
139 ++ # use color only if the prompt already contains color escapes
140 ++ case "${PS1}" in
141 ++ *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;;
142 ++ *) PS1="[${_ro_name}] ${PS1}" ;;
143 ++ esac
144 ++ fi
145 + else
146 + # Setup a bland default prompt. Since this prompt should be useable
147 + # on color and non-color terminals, as well as shells that don't
148 +@@ -57,9 +145,43 @@
149 + PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
150 + fi
151 +
152 ++# when chaining prefixes, we want the prompt to be passed to the child too,
153 ++# so we need to export it.
154 ++export PS1
155 ++
156 + for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
157 + if [ -r "$sh" ] ; then
158 + . "$sh"
159 + fi
160 + done
161 + unset sh
162 ++
163 ++#
164 ++# finally chain the save variables for previous prefixes in the chain.
165 ++#
166 ++if [[ -n "${_ro_chained_path_vars}" ]]; then
167 ++ for var in ${_ro_chained_path_vars}; do
168 ++ eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}"
169 ++ eval "unset _ro_backupenv_paths_${var}"
170 ++ done
171 ++fi
172 ++
173 ++#
174 ++# final finally set EPREFIX to our prefix if we don't have a local portage. this
175 ++# was previously done by the startprefix script, but we want to be able to start
176 ++# this environment by simply sourcing etc/profile with the correct shell.
177 ++#
178 ++if [[ -z "${EPREFIX}" ]]; then
179 ++ if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
180 ++ export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
181 ++ fi
182 ++elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then
183 ++ echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
184 ++ echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
185 ++ echo " Having EPREFIX set this way will probably render this environment unusable."
186 ++fi
187 ++
188 ++unset _ro_root
189 ++unset _ro_deps
190 ++unset _ro_chained_path_vars
191 ++
192 +diff -r 3eab7cc2a551 -r 0498f0edbf9f baselayout-prefix/sbin/runscript.sh
193 +--- a/baselayout-prefix/sbin/runscript.sh Thu Apr 28 18:25:46 2011 +0000
194 ++++ b/baselayout-prefix/sbin/runscript.sh Thu Apr 28 20:38:14 2011 +0200
195 +@@ -1,4 +1,4 @@
196 +-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
197 ++#! /usr/bin/env bash
198 + # Copyright 1999-2007 Gentoo Foundation
199 + # Distributed under the terms of the GNU General Public License v2
200 +
201
202 Deleted: trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch
203 ===================================================================
204 --- trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch 2011-04-28 18:25:46 UTC (rev 1704)
205 +++ trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch 2011-04-28 18:42:00 UTC (rev 1705)
206 @@ -1,190 +0,0 @@
207 -# HG changeset patch
208 -# User Markus Duft <mduft@g.o>
209 -# Date 1301591825 -7200
210 -# Node ID 95bbe3bfa150477a4b13894b675d836b20f9cde8
211 -# Parent 1df7e0823f1283d1fc9a71e10a89ff2757092dbc
212 -imported patch baselayout-1.12.5-prefix-chaining.patch
213 -
214 -diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/etc/profile
215 ---- a/baselayout-prefix/etc/profile Thu Mar 31 16:49:00 2011 +0000
216 -+++ b/baselayout-prefix/etc/profile Thu Mar 31 19:17:05 2011 +0200
217 -@@ -4,6 +4,62 @@
218 - # environment for login shells.
219 - #
220 -
221 -+#
222 -+# for prefix-chaining, the very first thing to do is to load
223 -+# the profiles for all chained instances above.
224 -+#
225 -+# TODO: is it safe in any case to shell source make.conf?
226 -+# don't do any recursive expansion here. if the parent can
227 -+# use READONLY_EPREFIX's, it has to have the same profile as
228 -+# we have here, and thus it will source parents before
229 -+# evaluating anything from itself.
230 -+#
231 -+_ro_root=$(. "@GENTOO_PORTAGE_EPREFIX@"/etc/make.conf && echo $READONLY_EPREFIX)
232 -+_ro_deps=${_ro_root#*:}
233 -+_ro_root=${_ro_root%:*}
234 -+
235 -+#
236 -+# prevent dooming of _ro_* variables by recursing down the
237 -+# profile chain, by backing the up, tagged by resursion depth.
238 -+#
239 -+
240 -+[[ -z "${_ro_recursion_level}" ]] && _ro_recursion_level=0
241 -+((++_ro_recursion_level))
242 -+
243 -+for _ro_backup_var in _ro_root _ro_deps; do
244 -+ eval "_ro_b${_ro_recursion_level}_${_ro_backup_var}=\${${_ro_backup_var}}"
245 -+done
246 -+
247 -+if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then
248 -+ . "${_ro_root}"/etc/profile
249 -+fi
250 -+
251 -+for _ro_backup_var in _ro_root _ro_deps; do
252 -+ eval "${_ro_backup_var}=\${_ro_b${_ro_recursion_level}_${_ro_backup_var}}"
253 -+done
254 -+
255 -+((--_ro_recursion_level))
256 -+
257 -+#
258 -+# With prefix-chaining we want another set of variables that
259 -+# should be retained for all prefixes. for example it is ok
260 -+# to retain PKG_CONFIG_PATH if the parent of the chain can
261 -+# be used to resolve RDEPEND...
262 -+#
263 -+if [[ -n "${_ro_root}" ]]; then
264 -+ _ro_chained_path_vars="PATH MANPATH"
265 -+
266 -+ if [[ ${_ro_deps} == *RDEPEND* ]]; then
267 -+ _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
268 -+ else
269 -+ unset PKG_CONFIG_PATH
270 -+ fi
271 -+
272 -+ for var in ${_ro_chained_path_vars}; do
273 -+ eval "_ro_backupenv_paths_${var}=\${${var}}"
274 -+ done
275 -+fi
276 -+
277 - # Load environment settings from profile.env, which is created by
278 - # env-update from the files in /etc/env.d
279 - if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then
280 -@@ -21,10 +77,17 @@
281 - # It is intentional in the following line to use || instead of -o.
282 - # This way the evaluation can be short-circuited and calling whoami is
283 - # avoided.
284 -+#
285 -+# system directories are only appended if this prefix is the last
286 -+# one in a chain of prefixes (or the only prefix in the chain), so
287 -+# that they don't end up in the middle of multiple different prefix
288 -+# paths (profile is recursive now, see above!)
289 - if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
290 -- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin"
291 -+ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}"
292 -+ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
293 - else
294 -- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin"
295 -+ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}"
296 -+ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/bin:/bin"
297 - fi
298 - export PATH
299 - unset ROOTPATH
300 -@@ -47,9 +110,34 @@
301 - # it in the user's dot-files), but it shouldn't make any
302 - # difference.
303 - . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
304 -+ elif [ -n "${_ro_root}" ]; then
305 -+ # We're in a prefix chain, but have no local bash. we rely on bash
306 -+ # beeing there _somewhere_ in the chain, so we do not need to set
307 -+ # PS1 explicitly.
308 -+ if [ -z "${PS1}" ]; then
309 -+ # try harder to find something in the parent prefix of the chain.
310 -+ # dont bother to search multiple chain members up to the top.
311 -+ if [ -f "${_ro_root}/etc/bash/bashrc" ]; then
312 -+ . "${_ro_root}/etc/bash/bashrc"
313 -+ fi
314 -+ fi
315 - else
316 - PS1='\u@\h \w \$ '
317 - fi
318 -+
319 -+ # Set the last dirpart of the current prefix somewhere
320 -+ # in the prompt, so one immediately knows where he/she is.
321 -+ if [ ${_ro_recursion_level} == 0 ]; then
322 -+ # we're in the last prefix of the chain here.
323 -+ _ro_name="@GENTOO_PORTAGE_EPREFIX@"
324 -+ _ro_name="${_ro_name##*/}"
325 -+
326 -+ # use color only if the prompt already contains color escapes
327 -+ case "${PS1}" in
328 -+ *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;;
329 -+ *) PS1="[${_ro_name}] ${PS1}" ;;
330 -+ esac
331 -+ fi
332 - else
333 - # Setup a bland default prompt. Since this prompt should be useable
334 - # on color and non-color terminals, as well as shells that don't
335 -@@ -57,9 +145,43 @@
336 - PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
337 - fi
338 -
339 -+# when chaining prefixes, we want the prompt to be passed to the child too,
340 -+# so we need to export it.
341 -+export PS1
342 -+
343 - for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
344 - if [ -r "$sh" ] ; then
345 - . "$sh"
346 - fi
347 - done
348 - unset sh
349 -+
350 -+#
351 -+# finally chain the save variables for previous prefixes in the chain.
352 -+#
353 -+if [[ -n "${_ro_chained_path_vars}" ]]; then
354 -+ for var in ${_ro_chained_path_vars}; do
355 -+ eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}"
356 -+ eval "unset _ro_backupenv_paths_${var}"
357 -+ done
358 -+fi
359 -+
360 -+#
361 -+# final finally set EPREFIX to our prefix if we don't have a local portage. this
362 -+# was previously done by the startprefix script, but we want to be able to start
363 -+# this environment by simply sourcing etc/profile with the correct shell.
364 -+#
365 -+if [[ -z "${EPREFIX}" ]]; then
366 -+ if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
367 -+ export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
368 -+ fi
369 -+elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then
370 -+ echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
371 -+ echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
372 -+ echo " Having EPREFIX set this way will probably render this environment unusable."
373 -+fi
374 -+
375 -+unset _ro_root
376 -+unset _ro_deps
377 -+unset _ro_chained_path_vars
378 -+
379 -diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/sbin/env-update.sh
380 ---- a/baselayout-prefix/sbin/env-update.sh Thu Mar 31 16:49:00 2011 +0000
381 -+++ b/baselayout-prefix/sbin/env-update.sh Thu Mar 31 19:17:05 2011 +0200
382 -@@ -1,4 +1,4 @@
383 --#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
384 -+#! /usr/bin/env bash
385 - # Copyright 1999-2004 Gentoo Foundation
386 - # Distributed under the terms of the GNU General Public License v2
387 -
388 -diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/sbin/runscript.sh
389 ---- a/baselayout-prefix/sbin/runscript.sh Thu Mar 31 16:49:00 2011 +0000
390 -+++ b/baselayout-prefix/sbin/runscript.sh Thu Mar 31 19:17:05 2011 +0200
391 -@@ -1,4 +1,4 @@
392 --#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
393 -+#! /usr/bin/env bash
394 - # Copyright 1999-2006 Gentoo Foundation
395 - # Distributed under the terms of the GNU General Public License v2
396 -
397
398 Modified: trunk/baselayout-prefix/etc/profile
399 ===================================================================
400 --- trunk/baselayout-prefix/etc/profile 2011-04-28 18:25:46 UTC (rev 1704)
401 +++ trunk/baselayout-prefix/etc/profile 2011-04-28 18:42:00 UTC (rev 1705)
402 @@ -4,6 +4,62 @@
403 # environment for login shells.
404 #
405
406 +#
407 +# for prefix-chaining, the very first thing to do is to load
408 +# the profiles for all chained instances above.
409 +#
410 +# TODO: is it safe in any case to shell source make.conf?
411 +# don't do any recursive expansion here. if the parent can
412 +# use READONLY_EPREFIX's, it has to have the same profile as
413 +# we have here, and thus it will source parents before
414 +# evaluating anything from itself.
415 +#
416 +_ro_root=$(. "@GENTOO_PORTAGE_EPREFIX@"/etc/make.conf && echo $READONLY_EPREFIX)
417 +_ro_deps=${_ro_root#*:}
418 +_ro_root=${_ro_root%:*}
419 +
420 +#
421 +# prevent dooming of _ro_* variables by recursing down the
422 +# profile chain, by backing the up, tagged by resursion depth.
423 +#
424 +
425 +[[ -z "${_ro_recursion_level}" ]] && _ro_recursion_level=0
426 +((++_ro_recursion_level))
427 +
428 +for _ro_backup_var in _ro_root _ro_deps; do
429 + eval "_ro_b${_ro_recursion_level}_${_ro_backup_var}=\${${_ro_backup_var}}"
430 +done
431 +
432 +if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then
433 + . "${_ro_root}"/etc/profile
434 +fi
435 +
436 +for _ro_backup_var in _ro_root _ro_deps; do
437 + eval "${_ro_backup_var}=\${_ro_b${_ro_recursion_level}_${_ro_backup_var}}"
438 +done
439 +
440 +((--_ro_recursion_level))
441 +
442 +#
443 +# With prefix-chaining we want another set of variables that
444 +# should be retained for all prefixes. for example it is ok
445 +# to retain PKG_CONFIG_PATH if the parent of the chain can
446 +# be used to resolve RDEPEND...
447 +#
448 +if [[ -n "${_ro_root}" ]]; then
449 + _ro_chained_path_vars="PATH MANPATH"
450 +
451 + if [[ ${_ro_deps} == *RDEPEND* ]]; then
452 + _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
453 + else
454 + unset PKG_CONFIG_PATH
455 + fi
456 +
457 + for var in ${_ro_chained_path_vars}; do
458 + eval "_ro_backupenv_paths_${var}=\${${var}}"
459 + done
460 +fi
461 +
462 # Load environment settings from profile.env, which is created by
463 # env-update from the files in /etc/env.d
464 if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then
465 @@ -21,10 +77,17 @@
466 # It is intentional in the following line to use || instead of -o.
467 # This way the evaluation can be short-circuited and calling whoami is
468 # avoided.
469 +#
470 +# system directories are only appended if this prefix is the last
471 +# one in a chain of prefixes (or the only prefix in the chain), so
472 +# that they don't end up in the middle of multiple different prefix
473 +# paths (profile is recursive now, see above!)
474 if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
475 - PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin"
476 + PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}"
477 + [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
478 else
479 - PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin"
480 + PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}"
481 + [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/bin:/bin"
482 fi
483 export PATH
484 unset ROOTPATH
485 @@ -47,9 +110,34 @@
486 # it in the user's dot-files), but it shouldn't make any
487 # difference.
488 . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
489 + elif [ -n "${_ro_root}" ]; then
490 + # We're in a prefix chain, but have no local bash. we rely on bash
491 + # beeing there _somewhere_ in the chain, so we do not need to set
492 + # PS1 explicitly.
493 + if [ -z "${PS1}" ]; then
494 + # try harder to find something in the parent prefix of the chain.
495 + # dont bother to search multiple chain members up to the top.
496 + if [ -f "${_ro_root}/etc/bash/bashrc" ]; then
497 + . "${_ro_root}/etc/bash/bashrc"
498 + fi
499 + fi
500 else
501 PS1='\u@\h \w \$ '
502 fi
503 +
504 + # Set the last dirpart of the current prefix somewhere
505 + # in the prompt, so one immediately knows where he/she is.
506 + if [ ${_ro_recursion_level} == 0 ]; then
507 + # we're in the last prefix of the chain here.
508 + _ro_name="@GENTOO_PORTAGE_EPREFIX@"
509 + _ro_name="${_ro_name##*/}"
510 +
511 + # use color only if the prompt already contains color escapes
512 + case "${PS1}" in
513 + *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;;
514 + *) PS1="[${_ro_name}] ${PS1}" ;;
515 + esac
516 + fi
517 else
518 # Setup a bland default prompt. Since this prompt should be useable
519 # on color and non-color terminals, as well as shells that don't
520 @@ -57,9 +145,43 @@
521 PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
522 fi
523
524 +# when chaining prefixes, we want the prompt to be passed to the child too,
525 +# so we need to export it.
526 +export PS1
527 +
528 for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
529 if [ -r "$sh" ] ; then
530 . "$sh"
531 fi
532 done
533 unset sh
534 +
535 +#
536 +# finally chain the save variables for previous prefixes in the chain.
537 +#
538 +if [[ -n "${_ro_chained_path_vars}" ]]; then
539 + for var in ${_ro_chained_path_vars}; do
540 + eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}"
541 + eval "unset _ro_backupenv_paths_${var}"
542 + done
543 +fi
544 +
545 +#
546 +# final finally set EPREFIX to our prefix if we don't have a local portage. this
547 +# was previously done by the startprefix script, but we want to be able to start
548 +# this environment by simply sourcing etc/profile with the correct shell.
549 +#
550 +if [[ -z "${EPREFIX}" ]]; then
551 + if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
552 + export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
553 + fi
554 +elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then
555 + echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
556 + echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
557 + echo " Having EPREFIX set this way will probably render this environment unusable."
558 +fi
559 +
560 +unset _ro_root
561 +unset _ro_deps
562 +unset _ro_chained_path_vars
563 +
564
565 Modified: trunk/baselayout-prefix/sbin/runscript.sh
566 ===================================================================
567 --- trunk/baselayout-prefix/sbin/runscript.sh 2011-04-28 18:25:46 UTC (rev 1704)
568 +++ trunk/baselayout-prefix/sbin/runscript.sh 2011-04-28 18:42:00 UTC (rev 1705)
569 @@ -1,4 +1,4 @@
570 -#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
571 +#! /usr/bin/env bash
572 # Copyright 1999-2007 Gentoo Foundation
573 # Distributed under the terms of the GNU General Public License v2