diff options
author | Alexey Neyman <stilor@att.net> | 2017-01-28 00:11:08 -0800 |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2017-01-30 12:10:47 -0800 |
commit | 7d1b203d06408f9dcc360095b46b8e73e870ee3c (patch) | |
tree | b77bf69afd45b11849d0d542928cad20d3c057cb /scripts/override | |
parent | a08a4c4b88fa2b2d770bda1fb1590ca80904fca7 (diff) | |
download | crosstool-ng-7d1b203d06408f9dcc360095b46b8e73e870ee3c.tar.gz crosstool-ng-7d1b203d06408f9dcc360095b46b8e73e870ee3c.tar.bz2 crosstool-ng-7d1b203d06408f9dcc360095b46b8e73e870ee3c.zip |
Add install wrapper
... to work around Gentoo's wrapper idiosyncrasy.
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/override')
-rw-r--r-- | scripts/override/install | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/override/install b/scripts/override/install new file mode 100644 index 00000000..e3954fb6 --- /dev/null +++ b/scripts/override/install @@ -0,0 +1,35 @@ +#!@CONFIG_SHELL@ + +# Do the most common case first +if [ -z "${__PORTAGE_HELPER_PATH}" ]; then + exec @TOOL_PATH@ "$@" +fi + +# Not so simple case: Gentoo uses *two* wrappers around install script +# to deal with extended attributes: +# - /usr/lib/portage/python*/ebuild-helpers/xattr/install +# This sets __PORTAGE_HELPER_PATH (see the check above) and +# invokes either C- or Python-based wrapper (they do the same +# thing anyway). E.g., let it be /usr/bin/install-xattrs... +# - /usr/bin/install-xattrs +# This now analyzes $PATH and invokes 'install' in the first directory +# in $PATH where it is found, but not the __PORTAGE_HELPER_PATH +# This scheme breaks if we interject another install wrapper, resulting +# in a fork bomb. Hence, if we detected a loop, we need to remove our +# own directory from $PATH and try again. Ironically, the very code below +# based on that portage helper. +IFS=: +set -f +path= +for x in ${PATH}; do + case "${x}" in + @TOOLS_OVERRIDE_DIR@/bin) continue;; + esac + if test -n "${path}"; then + path="${path}:${x}" + else + path="${x}" + fi +done +PATH="${path}" +exec @TOOL_PATH@ "$@" |