diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2021-08-13 13:34:47 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2021-08-13 13:34:47 -0400 |
| commit | 5defd6cafc07c6445c5f8fdcebfba82f6270a07c (patch) | |
| tree | 63ba278410d7ba3ac86aa5fb0886830929841652 /scripts | |
| parent | 1b3faeb689b75491a9701e98cf0a9123ddba32cb (diff) | |
adding pth uninstallation to install api script and linux setup script
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/install_api.py | 20 | ||||
| -rwxr-xr-x | scripts/linux-setup.sh | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/scripts/install_api.py b/scripts/install_api.py index 4504ea71..290300a2 100755 --- a/scripts/install_api.py +++ b/scripts/install_api.py @@ -31,16 +31,34 @@ if '-v' in sys.argv[1:]: try: import binaryninja import binaryninjaui #To better detect if migrating from a version without UI plugin support + if '-u' in sys.argv[1:]: + #Uninstall mode + userpth = os.path.join(getusersitepackages(), 'binaryninja.pth') + if os.path.exists(userpth): + print(f"Removing {userpth}") + os.unlink(userpth) + sitepth = os.path.join(getsitepackages()[0], 'binaryninja.pth') + if os.path.exists(sitepth): + print(f"Removing {sitepth}") + try: + os.unlink(sitepth) + except: + print("Unable to unlink, please re-run with appropriate permissions.") + sys.exit(0) print("Binary Ninja API already in the path") sys.exit(1) except ImportError: pass +if '-u' in sys.argv[1:]: + print("Uninstall specified, but binaryninja not in the current path") + sys.exit(1) + dir_name = os.path.dirname(os.path.abspath(__file__)) api_path = os.path.abspath(os.path.join(dir_name, "..", "python")) if (os.path.isdir(api_path)): - print("Found install folder of {}".format(api_path)) + print(f"Found install folder of {api_path}") else: print("Failed to find installed python expected at {}".format(api_path)) sys.exit(1) diff --git a/scripts/linux-setup.sh b/scripts/linux-setup.sh index 8c3c6d2d..d00178f4 100755 --- a/scripts/linux-setup.sh +++ b/scripts/linux-setup.sh @@ -157,6 +157,7 @@ uninstall() { rm -i -r "$DESKTOPFILE" "$MIMEFILE" "$IMAGEFILE" "${HOME}/Desktop/${APP}.desktop" $SUDO update-mime-database ${SHARE}/mime + python3 -V >/dev/null 2>&1 && ${SUDO}python3 "${BNPATH}/scripts/install_api.py" -u exit 0 } |
