From 0f8c8632b1c38e846f0beb0213d05b1306c410fa Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Sun, 15 Nov 2020 22:16:13 +0000 Subject: [PATCH] Tor from source (#1769) --- home.admin/99updateMenu.sh | 9 +++++ home.admin/config.scripts/internet.tor.sh | 40 +++++++++++++++++++---- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/home.admin/99updateMenu.sh b/home.admin/99updateMenu.sh index 65991f90..79c72588 100755 --- a/home.admin/99updateMenu.sh +++ b/home.admin/99updateMenu.sh @@ -297,6 +297,9 @@ fi if [ "${pyblock}" == "on" ]; then OPTIONS+=(PYBLOCK "Update PyBLOCK") fi +if [ "${runBehindTor}" == "on" ]; then + OPTIONS+=(TOR "Update Tor from the source code") +fi CHOICE=$(whiptail --clear --title "Update Options" --menu "" 13 55 6 "${OPTIONS[@]}" 2>&1 >/dev/tty) @@ -327,4 +330,10 @@ case $CHOICE in PYBLOCK) /home/admin/config.scripts/bonus.pyblock.sh update ;; + POOL) + /home/admin/config.scripts/bonus.pool.sh update + ;; + TOR) + sudo /home/admin/config.scripts/internet.tor.sh update + ;; esac diff --git a/home.admin/config.scripts/internet.tor.sh b/home.admin/config.scripts/internet.tor.sh index 2714ea9c..e64d1f49 100755 --- a/home.admin/config.scripts/internet.tor.sh +++ b/home.admin/config.scripts/internet.tor.sh @@ -8,7 +8,7 @@ # command info if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then echo "small config script to switch TOR on or off" - echo "internet.tor.sh [status|on|off|prepare|btcconf-on|btcconf-off|lndconf-on]" + echo "internet.tor.sh [status|on|off|prepare|btcconf-on|btcconf-off|lndconf-on|update]" exit 1 fi @@ -239,11 +239,13 @@ fi # make sure /etc/tor exists sudo mkdir /etc/tor 2>/dev/null -# stop services (if running) -echo "making sure services are not running" -sudo systemctl stop lnd 2>/dev/null -sudo systemctl stop ${network}d 2>/dev/null -sudo systemctl stop tor@default 2>/dev/null +if [ "$1" != "update" ]; then + # stop services (if running) + echo "making sure services are not running" + sudo systemctl stop lnd 2>/dev/null + sudo systemctl stop ${network}d 2>/dev/null + sudo systemctl stop tor@default 2>/dev/null +fi # switch on if [ "$1" = "1" ] || [ "$1" = "on" ]; then @@ -466,6 +468,32 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then exit 0 fi +# update +if [ "$1" = "update" ]; then + # as in https://2019.www.torproject.org/docs/debian#source + prepareTorSources + echo "# Install the dependencies" + sudo apt update + sudo apt install -y build-essential fakeroot devscripts + sudo apt build-dep -y tor deb.torproject.org-keyring + rm -rf /home/admin/download/debian-packages + mkdir -p /home/admin/download/debian-packages + cd /home/admin/download/debian-packages + echo "# Building Tor from the source code ..." + apt source tor + cd tor-* + debuild -rfakeroot -uc -us + cd .. + echo "# Stopping the tor.service before updating" + sudo systemctl stop tor + echo "# Update ..." + sudo dpkg -i tor_*.deb + echo "# Starting the tor.service " + sudo systemctl start tor + echo "# Installed $(tor --version)" + exit 0 +fi + echo "FAIL - Unknown Parameter $1" echo "may needs reboot to run normal again" exit 1