commit:     1cadae82d2a03b2ed7ba31cd08dd3911055ed924
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 24 22:18:21 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Sep 24 22:22:32 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1cadae82

Initial creation of a deprecated-path script

This script is for installed portage bin/ scripts that have been moved from 
their original installed path.
It will search the PATH for the script called and run it from there.

---
 bin/deprecated-path | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/bin/deprecated-path b/bin/deprecated-path
new file mode 100755
index 0000000..b8aaadb
--- /dev/null
+++ b/bin/deprecated-path
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Copyright 2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Author:
+#
+
+source /lib/gentoo/functions.sh
+
+scriptpath=${BASH_SOURCE[0]}
+scriptname=${scriptpath##*/}
+
+IFS=':'
+
+for path in ${PATH}; do
+       [[ -x ${path}/${scriptname} ]] || continue
+       [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
+
+       unset IFS
+       eerror "Deprecation warning: Calling ${scriptname} from wrong path: 
'${scriptpath}'"
+       eerror "Correct path should be '${path}/${scriptname}', Please correct 
your scripts or file a bug with the maintainer..."
+       exec "${path}/${scriptname}" "$@"
+done
+
+unset IFS
+
+eerror "ERROR: portage file: deprecated-path: Failed to locate ${scriptname} 
in PATH"
+eerror "PATH: ${PATH}"
+exit 1

Reply via email to