diff options
| author | rmspeers <ryan@riverloopsecurity.com> | 2018-11-28 21:11:03 -0500 |
|---|---|---|
| committer | Jordan <jordan@psifertex.com> | 2018-11-29 00:01:10 -0500 |
| commit | b5abb8b1e1b053c5d3ddd391469edc3ed02aa22c (patch) | |
| tree | d556192a229f7270f3fd8ffc53e3538bd6bef06d | |
| parent | 161786fc483515615399ba990254fba8d7d42876 (diff) | |
Updates for Python3 headless install.
| -rwxr-xr-x | scripts/install_api.py | 12 | ||||
| -rwxr-xr-x | scripts/linux-setup.sh | 9 |
2 files changed, 16 insertions, 5 deletions
diff --git a/scripts/install_api.py b/scripts/install_api.py index 2eca2292..1237e1e5 100755 --- a/scripts/install_api.py +++ b/scripts/install_api.py @@ -7,6 +7,11 @@ import sys import os from site import getsitepackages, getusersitepackages, check_enableusersite +# Hacky command line parsing to accept a silent-install -s flag like linux-setup.sh: +INTERACTIVE = True +if '-s' in sys.argv[1:]: + INTERACTIVE = False + try: import binaryninja print("Binary Ninja API already Installed") @@ -51,9 +56,12 @@ def validate_path(path): while not validate_path(api_path): - print("\nBinary Ninja not found. Please provide the path to Binary " + \ - "Ninja's install directory: \n [{}] : ".format(api_path)) + print("\nBinary Ninja not found.") + if not INTERACTIVE: + print("Non-interactive mode selected, failing.") + sys.exit(-1) + print("Please provide the path to Binary Ninja's install directory: \n [{}] : ".format(api_path)) new_path = sys.stdin.readline().strip() if len(new_path) == 0: print("\nInvalid path") diff --git a/scripts/linux-setup.sh b/scripts/linux-setup.sh index 655af22d..f2d61589 100755 --- a/scripts/linux-setup.sh +++ b/scripts/linux-setup.sh @@ -65,11 +65,11 @@ lastrun() pythonpath() { echo Configuring python path - if [[ $(python -V) == "Python 3."* ]] + if [ "USERINTERACTIVE" == "true" ] then - ${SUDO}python2 ${BNPATH}/scripts/install_api.py $ROOT - else ${SUDO}python ${BNPATH}/scripts/install_api.py $ROOT + else + ${SUDO}python ${BNPATH}/scripts/install_api.py $ROOT -s fi } @@ -139,6 +139,7 @@ CREATEDESKTOP=true CREATEMIME=true ADDTODESKTOP=true CREATELASTRUN=true +USERINTERACTIVE=true PYTHONPATH=true UNINSTALL=false @@ -158,6 +159,7 @@ do ;; -d) ADDTODESKTOP=false + CREATEDESKTOP=false ;; -m) CREATEMIME=false @@ -169,6 +171,7 @@ do ADDTODESKTOP=false CREATEMIME=false CREATEDESKTOP=false + USERINTERACTIVE=false ;; -h|*) usage |
