Last active
December 18, 2020 15:31
-
-
Save Tasssadar/9c4d63f617731bb4f74e5acc1af9c226 to your computer and use it in GitHub Desktop.
Patch JEB 3.8+ GenRegisterJebUriScheme.py to generate registrator also on Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- GenRegisterJebUriScheme.py.orig 2020-01-08 09:41:43.260903761 +0100 | |
+++ GenRegisterJebUriScheme.py 2020-01-08 14:15:01.278159846 +0100 | |
@@ -1,7 +1,7 @@ | |
''' | |
Generate a platform-dependant script used to register the custom URI handler 'jeb:', | |
which can be used to execute JEB from other applications. | |
-TODO: only Windows is implemented; add Linux and macOS | |
+TODO: only Windows and Linux is implemented; add macOS | |
How to use: | |
- once the 'jeb:' URI handler is registered, other applications can invoke JEB | |
@@ -40,10 +40,42 @@ | |
text = template % path.replace('\\', '\\\\') | |
outname = 'RegisterJebUriScheme.reg' | |
+elif n == 'Linux': | |
+ template = r'''#!/bin/sh | |
+set -uex | |
+ | |
+if which xdg-mime > /dev/null; then | |
+ DESKTOP_DIR="$HOME/.local/share/applications" | |
+ DESKTOP_PATH="$DESKTOP_DIR/jeb-opener.desktop" | |
+ | |
+ cat << EOF > "$DESKTOP_PATH" | |
+[Desktop Entry] | |
+Type=Application | |
+Name=JEB decompiler scheme handler | |
+Exec="{jeb_bin_path}" %u | |
+StartupNotify=true | |
+MimeType=x-scheme-handler/jeb; | |
+EOF | |
+ | |
+ xdg-mime default "$DESKTOP_PATH" x-scheme-handler/jeb | |
+ update-desktop-database "$DESKTOP_DIR" | |
+fi | |
+ | |
+if which gconftool-2 > /dev/null; then | |
+ gconftool-2 -t string -s /desktop/gnome/url-handlers/jeb/command '"{jeb_bin_path}" "%s"' | |
+ gconftool-2 -s /desktop/gnome/url-handlers/jeb/needs_terminal false -t bool | |
+ gconftool-2 -s /desktop/gnome/url-handlers/jeb/enabled true -t bool | |
+fi | |
+''' | |
+ | |
+ path = os.path.abspath(os.getcwd() + r'/../../jeb_linux.sh') | |
+ text = template.format(jeb_bin_path=path) | |
+ outname = 'RegisterJebUriScheme.sh' | |
+ | |
else: | |
print('Not implemented for platform %s!' % n) | |
sys.exit(-1) | |
- | |
+ | |
with open(outname, 'w') as f: | |
f.write(text) | |
print('Execute the generated file %s to register the JEB URI scheme.' % outname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compiler smart contract & source code for https://etherscan.io/address/0x0000000000000000000000000000000000000000