aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben ten Hove <git@rhtenhove.nl>2020-05-14 19:16:04 +0200
committerDominik Maier <domenukk@gmail.com>2020-05-14 21:49:36 +0200
commit4c253aedae6aec48d527668d699d124962d82821 (patch)
tree58084945b5051d7c707ac2d39483744cca70ffa2
parentefdad526eea9ec449ef0eefbd0da705901bcaf2f (diff)
downloadafl++-4c253aedae6aec48d527668d699d124962d82821.tar.gz
use --python flag to point to python executable for qemu build
-rwxr-xr-xqemu_mode/build_qemu_support.sh28
1 files changed, 10 insertions, 18 deletions
diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh
index 983373ce..1828528e 100755
--- a/qemu_mode/build_qemu_support.sh
+++ b/qemu_mode/build_qemu_support.sh
@@ -76,18 +76,14 @@ for i in libtool wget automake autoconf sha384sum bison flex iconv patch pkg-con
done
-PYTHON_TEMP_SYMLINK=0
-if ! command -v python 1>/dev/null; then
- if command -v python3 1>/dev/null; then
- echo "[*] 'python' not found. 'python3' was found. Creating temporary symlink."
- update-alternatives --install /usr/bin/python python "$(command -v python3)" 0 1>/dev/null
- PYTHON_TEMP_SYMLINK=1
- else
- echo "[-] Error: 'python' not found, please install using 'sudo apt install python3'."
- PREREQ_NOTFOUND=1
- fi
+PYTHONBIN=`command -v python3 || command -v python || command -v python2`
+
+if [ "$PYTHONBIN" = "" ]; then
+ echo "[-] Error: 'python' not found, please install using 'sudo apt install python3'."
+ PREREQ_NOTFOUND=1
fi
+
if [ ! -d "/usr/include/glib-2.0/" -a ! -d "/usr/local/include/glib-2.0/" ]; then
echo "[-] Error: devel version of 'glib2' not found, please install first."
@@ -214,16 +210,17 @@ if [ "$STATIC" = "1" ]; then
--disable-libusb --disable-usb-redir --disable-vde --disable-vhost-net --disable-virglrenderer \
--disable-virtfs --disable-vnc --disable-vte --disable-xen --disable-xen-pci-passthrough --disable-xfsctl \
--enable-linux-user --disable-system --disable-blobs --disable-tools --enable-capstone=internal \
- --target-list="${CPU_TARGET}-linux-user" --static --disable-pie --cross-prefix=$CROSS_PREFIX || exit 1
+ --target-list="${CPU_TARGET}-linux-user" --static --disable-pie --cross-prefix=$CROSS_PREFIX --python="$PYTHONBIN" \
+ || exit 1
else
# --enable-pie seems to give a couple of exec's a second performance
# improvement, much to my surprise. Not sure how universal this is..
-
+
./configure --disable-system \
--enable-linux-user --disable-gtk --disable-sdl --disable-vnc --enable-capstone=internal \
- --target-list="${CPU_TARGET}-linux-user" --enable-pie $CROSS_PREFIX || exit 1
+ --target-list="${CPU_TARGET}-linux-user" --enable-pie $CROSS_PREFIX --python="$PYTHONBIN" || exit 1
fi
@@ -292,11 +289,6 @@ make -C libcompcov && echo "[+] libcompcov ready"
echo "[+] Building unsigaction ..."
make -C unsigaction && echo "[+] unsigaction ready"
-if [ "PYTHON_TEMP_SYMLINK" = "1" ]; then
- echo "[*] Removing temporary symlink for 'python'"
- update-alternatives --remove python /usr/bin/python
-fi
-
echo "[+] All done for qemu_mode, enjoy!"
exit 0