about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-05-14 18:00:48 +0200
committerhexcoder- <heiko@hexco.de>2020-05-14 18:00:48 +0200
commit460760d7b6aa88d772c8d5075327ffefa06576d7 (patch)
tree0132f57fe8a9ac7145f0a288569925fd68890246
parent4e192db13caa8a6c5234c282986f91c8aaf49e20 (diff)
downloadafl++-460760d7b6aa88d772c8d5075327ffefa06576d7.tar.gz
unicornafl build script: find matching python and setuptools
-rwxr-xr-xunicorn_mode/build_unicorn_support.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/unicorn_mode/build_unicorn_support.sh b/unicorn_mode/build_unicorn_support.sh
index 805ac1ea..6c133f21 100755
--- a/unicorn_mode/build_unicorn_support.sh
+++ b/unicorn_mode/build_unicorn_support.sh
@@ -107,11 +107,13 @@ for i in $PYTHONBIN automake autoconf git $MAKECMD $TARCMD; do
 
 done
 
-if ! command -v $EASY_INSTALL >/dev/null; then
+# some python version should be available now
+PYTHONS="`command -v python3` `command -v python` `command -v python2`"
+EASY_INSTALL_FOUND=0
+for PYTHON in $PYTHONS ; do
 
   # work around for installs with executable easy_install
-  EASY_INSTALL_FOUND=0
-  MYPYTHONPATH=`${PYTHONBIN} -v </dev/null 2>&1 >/dev/null | sed -n -e '/^# \/.*\/os.py/{ s/.*matches //; s/os.py$//; p;}'`
+  MYPYTHONPATH=`${PYTHON} -v </dev/null 2>&1 >/dev/null | sed -n -e '/^# \/.*\/os.py/{ s/.*matches //; s/os.py$//; p;}'`
   for PATHCANDIDATE in \
         "dist-packages/" \
         "site-packages/"
@@ -119,16 +121,17 @@ if ! command -v $EASY_INSTALL >/dev/null; then
     if [ -e "${MYPYTHONPATH}/${PATHCANDIDATE}/easy_install.py" ] ; then
 
       EASY_INSTALL_FOUND=1
+      PYTHONBIN=$PYTHON
       break
 
     fi
   done
-  if [ "0" = $EASY_INSTALL_FOUND ]; then
 
-    echo "[-] Error: Python setup-tools not found. Run 'sudo apt-get install python-setuptools'."
-    PREREQ_NOTFOUND=1
+done
+if [ "0" = $EASY_INSTALL_FOUND ]; then
 
-  fi
+  echo "[-] Error: Python setup-tools not found. Run 'sudo apt-get install python-setuptools'."
+  PREREQ_NOTFOUND=1
 
 fi