1 |
commit: 1cadae82d2a03b2ed7ba31cd08dd3911055ed924 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 24 22:18:21 2014 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Sep 24 22:22:32 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1cadae82 |
7 |
|
8 |
Initial creation of a deprecated-path script |
9 |
|
10 |
This script is for installed portage bin/ scripts that have been moved from their original installed path. |
11 |
It will search the PATH for the script called and run it from there. |
12 |
|
13 |
--- |
14 |
bin/deprecated-path | 28 ++++++++++++++++++++++++++++ |
15 |
1 file changed, 28 insertions(+) |
16 |
|
17 |
diff --git a/bin/deprecated-path b/bin/deprecated-path |
18 |
new file mode 100755 |
19 |
index 0000000..b8aaadb |
20 |
--- /dev/null |
21 |
+++ b/bin/deprecated-path |
22 |
@@ -0,0 +1,28 @@ |
23 |
+#!/bin/bash |
24 |
+# Copyright 2014 Gentoo Foundation |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+# Author: |
27 |
+# |
28 |
+ |
29 |
+source /lib/gentoo/functions.sh |
30 |
+ |
31 |
+scriptpath=${BASH_SOURCE[0]} |
32 |
+scriptname=${scriptpath##*/} |
33 |
+ |
34 |
+IFS=':' |
35 |
+ |
36 |
+for path in ${PATH}; do |
37 |
+ [[ -x ${path}/${scriptname} ]] || continue |
38 |
+ [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue |
39 |
+ |
40 |
+ unset IFS |
41 |
+ eerror "Deprecation warning: Calling ${scriptname} from wrong path: '${scriptpath}'" |
42 |
+ eerror "Correct path should be '${path}/${scriptname}', Please correct your scripts or file a bug with the maintainer..." |
43 |
+ exec "${path}/${scriptname}" "$@" |
44 |
+done |
45 |
+ |
46 |
+unset IFS |
47 |
+ |
48 |
+eerror "ERROR: portage file: deprecated-path: Failed to locate ${scriptname} in PATH" |
49 |
+eerror "PATH: ${PATH}" |
50 |
+exit 1 |