Tor from source (#1769)

This commit is contained in:
openoms 2020-11-15 22:16:13 +00:00 committed by rootzoll
parent b010ee3cf0
commit 0f8c8632b1
2 changed files with 43 additions and 6 deletions

View File

@ -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

View File

@ -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