gnunet-qr.py: align help with reality
[oweals/gnunet.git] / src / util / gnunet-qr.in
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 $@