Lines 2-10
Link Here
|
2 |
# Copyright 2009-2013 Gentoo Foundation |
2 |
# Copyright 2009-2013 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
|
4 |
|
|
|
5 |
scriptpath=${BASH_SOURCE[0]} |
6 |
scriptname=${scriptpath##*/} |
7 |
|
5 |
PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} |
8 |
PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} |
6 |
PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} |
9 |
PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} |
7 |
# Use safe cwd, avoiding unsafe import for bug #469338. |
10 |
# Use safe cwd, avoiding unsafe import for bug #469338. |
8 |
cd "${PORTAGE_PYM_PATH}" |
11 |
cd "${PORTAGE_PYM_PATH}" |
9 |
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ |
12 |
|
10 |
exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@" |
13 |
IFS=':' |
|
|
14 |
set -f # in case ${PATH} contains any shell glob characters |
15 |
|
16 |
for path in ${PATH}; do |
17 |
[[ -x ${path}/${scriptname} ]] || continue |
18 |
[[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue |
19 |
PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ |
20 |
exec "${PORTAGE_PYTHON:-/usr/bin/python}" \ |
21 |
"${path}/${scriptname}" "$@" |
22 |
done |
23 |
|
24 |
unset IFS |
25 |
echo "${scriptname}: command not found" 1>&2 |
26 |
exit 127 |
11 |
- |
|
|