12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/bin/sh
- cd `dirname $0`
- echo "Running I2P Bundle from $(pwd)..."
- # Runs i2pd
- _run_i2pd() {
- ulimit -n 4096
- if [ -f i2pd/i2pd ]; then
- i2pd/i2pd --datadir i2pd-data --httpproxy.enabled=1 --sam.enabled=1
- else
- i2pd --datadir i2pd-data --httpproxy.enabled=1 --sam.enabled=1
- fi
- }
- # Runs XD BitTorrent client
- _run_XD() {
- mkdir XD-data
- cd XD-data
- if [ -f ../XD/XD ]; then
- ../XD/XD torrents.ini
- else
- XD torrents.ini
- fi
- }
- # Runs tor
- _run_tor() {
- if [ -f tor/tor ]; then
- # NOTE: tor doesn't like relative paths in parameters
- # --User is left blank so that it can be run as normal user. Setting a
- # --User requires tor to be run as root, which is unnecessary.
- # Optionally, a custom torrc can be passed by adding:
- # -f "$PWD/tor-data/torrc"
- # Previously the parameters were in that torrc file above and the file
- # was passed with a -f parameter. But since there are just 3 changes
- # needed to run a basic i2p-tor browser setup, it's now parameterized.
- tor/tor --User "" --DataDirectory "$PWD/tor-data" --SOCKSPort 9450
- else
- tor --User "" --DataDirectory "$PWD/tor-data" --SOCKSPort 9450
- fi
- }
- _killit () {
- # Sends SIGQUIT (-3), waits for 7 seconds then sends SIGKILL (-9)
- pkill -3 $1 && sleep 7 && pkill -9 $1 || echo "$1 not running, so skipping pkill call"
- }
- # Run all the i2p stuff, plus tor before running browser
- # These will be killed later when browser quits. See "commands after semicolons" comment.
- _run_i2pd &
- _run_XD &
- _run_tor &
- # Prepare to run browser
- mkdir -p icecat-data
- echo "Attempting to run the browser..."
- echo "Once it runs you will be able to access:"
- echo "- i2pd panel: http://127.0.0.1:7070/"
- echo "- XD webui: http://127.0.0.1:1776/"
- # Run browser. Commands after semicolons are run after Ctrl+C is pressed or icecat is quit.
- icecat/icecat --no-remote --profile "$PWD/icecat-data";
- echo "Killing XD, i2pd and tor...";
- _killit XD &
- _killit i2pd &
- _killit tor &
|