diff options
author | ng0 <ng0@n0.is> | 2019-02-26 08:35:45 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-02-26 08:35:45 +0000 |
commit | 5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0 (patch) | |
tree | 74e83f28ea8198bb1e934a770a6f082bd3ea7984 /src/util/gnunet-qr.in | |
parent | 689614a7e51f4fda776e99aa5892811fa5923b2d (diff) | |
download | gnunet-5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0.tar.gz gnunet-5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0.zip |
Proposed fix for https://bugs.gnunet.org/view.php?id=5611
Diffstat (limited to 'src/util/gnunet-qr.in')
-rwxr-xr-x | src/util/gnunet-qr.in | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/util/gnunet-qr.in b/src/util/gnunet-qr.in new file mode 100755 index 000000000..5e7a285ac --- /dev/null +++ b/src/util/gnunet-qr.in | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # From curl's buildconf, making this script subject to the | ||
4 | # curl license: https://curl.haxx.se/docs/copyright.html | ||
5 | # Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
6 | # Copyright (C) 2019 GNUnet e.V. | ||
7 | |||
8 | # findtool works like which without relying on which (which is a problem | ||
9 | # for some limited shells. | ||
10 | findtool(){ | ||
11 | file="$1" | ||
12 | |||
13 | if { echo "$file" | grep "/" >/dev/null 2>&1; } then | ||
14 | # when file is given with a path check it first | ||
15 | if test -f "$file"; then | ||
16 | echo "$file" | ||
17 | return | ||
18 | fi | ||
19 | fi | ||
20 | |||
21 | old_IFS=$IFS; IFS=':' | ||
22 | for path in $PATH | ||
23 | do | ||
24 | IFS=$old_IFS | ||
25 | # echo "checks for $file in $path" >&2 | ||
26 | if test "$path" -a "$path" != '.' -a -f "$path/$file"; then | ||
27 | echo "$path/$file" | ||
28 | return | ||
29 | fi | ||
30 | done | ||
31 | IFS=$old_IFS | ||
32 | } | ||
33 | |||
34 | # end curl licensed code | ||
35 | pythonize=`findtool python2.7 2>/dev/null` | ||
36 | if test ! -x "$pythonize"; then | ||
37 | pythonize=`findtool ${PYTHON2:-python2.7}` | ||
38 | fi | ||
39 | |||
40 | if test -z "$pythonize"; then | ||
41 | echo "ERROR: python2.7 not found." | ||
42 | echo " You need python2.7 installed." | ||
43 | exit 1 | ||
44 | fi | ||
45 | |||
46 | ${pythonize} @PREFIX@/bin/gnunet-qr.py || echo "ERROR: python2.7 or future not found" && exit 1 | ||