namecoin.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. diff -ru RelativeLink/start-tor-browser RelativeLinkNamecoin/start-tor-browser
  2. --- RelativeLink/start-tor-browser 2019-09-11 20:17:08.157789097 +0000
  3. +++ RelativeLinkNamecoin/start-tor-browser 2019-09-15 04:43:02.237434304 +0000
  4. @@ -169,6 +169,11 @@
  5. detach=0
  6. fi
  7. +# We can't detach and enable Namecoin at the same time..
  8. +if [ "$TOR_ENABLE_NAMECOIN" = 1 -a "$detach" -eq 1 ]; then
  9. + detach=0
  10. +fi
  11. +
  12. if [ "$show_output" -eq 0 ]; then
  13. # If the user hasn't requested 'debug mode' or --help, close stdout and stderr,
  14. # to keep Firefox and the stuff loaded by/for it (including the
  15. @@ -355,6 +360,41 @@
  16. #
  17. # The --class parameter was added to fix bug 11102.
  18. +# The Namecoin support in this script is a placeholder proof-of-concept only.
  19. +# In the real world this would be moved to Tor Launcher.
  20. +if [ "${TOR_ENABLE_NAMECOIN}" = 1 ]; then
  21. + if [ "$show_usage" -eq 1 ]; then
  22. + # No help exists for Namecoin
  23. + TOR_ENABLE_NAMECOIN=0
  24. + elif [ "$detach" -eq 1 ] ; then
  25. + # No support yet for detached Namecoin
  26. + TOR_ENABLE_NAMECOIN=0
  27. + elif [ "$log_output" -eq 1 -a "$show_output" -eq 1 ]; then
  28. + # No support yet for logging Namecoin
  29. + TOR_ENABLE_NAMECOIN=0
  30. + elif [ "$show_output" -eq 1 ]; then
  31. + # Launch Namecoin in verbose mode
  32. + echo "Launching Namecoin..."
  33. + grep --quiet "__LeaveStreamsUnattached 1" TorBrowser/Data/Tor/torrc-defaults || echo "__LeaveStreamsUnattached 1" >> TorBrowser/Data/Tor/torrc-defaults
  34. + TorBrowser/Electrum-NMC/run_electrum_nmc daemon -v --dir "TorBrowser/Data/Electrum-NMC/" &
  35. + ELECTRUM_NMC_PID=$!
  36. + python3 TorBrowser/StemNS/poc.py &
  37. + STEM_NS_PID=$!
  38. + echo "Launched Namecoin."
  39. + else
  40. + # Launch Namecoin
  41. + grep --quiet "__LeaveStreamsUnattached 1" TorBrowser/Data/Tor/torrc-defaults || echo "__LeaveStreamsUnattached 1" >> TorBrowser/Data/Tor/torrc-defaults
  42. + TorBrowser/Electrum-NMC/run_electrum_nmc daemon --dir "TorBrowser/Data/Electrum-NMC/" &
  43. + ELECTRUM_NMC_PID=$!
  44. + python3 TorBrowser/StemNS/poc.py &
  45. + STEM_NS_PID=$!
  46. + fi
  47. +fi
  48. +
  49. +if [ "${TOR_ENABLE_NAMECOIN}" != 1 ]; then
  50. + perl -i -p -e 's/__LeaveStreamsUnattached 1\n//' TorBrowser/Data/Tor/torrc-defaults
  51. +fi
  52. +
  53. if [ "$show_usage" -eq 1 ]; then
  54. # Display Firefox help, then our help
  55. TOR_CONTROL_PASSWD=${TOR_CONTROL_PASSWD} ./firefox --class "Tor Browser" \
  56. @@ -376,4 +416,13 @@
  57. -profile TorBrowser/Data/Browser/profile.default "${@}" > "$logfile" 2>&1 </dev/null
  58. fi
  59. -exit $?
  60. +FIREFOX_EXIT_CODE=$?
  61. +
  62. +if [ "${TOR_ENABLE_NAMECOIN}" = 1 ]; then
  63. + echo "Terminating Namecoin..."
  64. + kill ${ELECTRUM_NMC_PID}
  65. + kill -s SIGKILL ${STEM_NS_PID}
  66. + echo "Terminated Namecoin."
  67. +fi
  68. +
  69. +exit ${FIREFOX_EXIT_CODE}