2018-11-04 00:26:45 +01:00
#!/bin/sh
# INSTALLING THE RTL Webinterface from
# https://github.com/ShahanaFarooqui/RTL/blob/master/README.md
# get the local network IP to be displayed on the lCD
localip = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
2018-11-04 03:11:20 +01:00
# load network
network = ` sudo cat /home/admin/.network`
# get chain
chain = "test"
isMainChain = $( sudo cat /mnt/hdd/${ network } /${ network } .conf 2>/dev/null | grep "#testnet=1" -c)
if [ ${ isMainChain } -gt 0 ] ; then
chain = "main"
fi
2018-11-04 00:26:45 +01:00
echo "*** Check if RTL is installed ***"
2018-11-04 01:23:49 +01:00
isInstalled = $( sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service' )
2018-11-04 00:26:45 +01:00
if [ ${ isInstalled } -eq 1 ] ; then
2018-11-04 01:16:18 +01:00
echo "*** Dialog ***"
dialog --title "Deinstall: Ride The Lightning Web Interface" --yesno "RTL is installed. You you want to remove?" 5 50
response = $?
case $response in
1) exit 1 ; ;
esac
clear
echo "*** REMOVING RTL ***"
sudo systemctl stop RTL
sudo systemctl disable RTL
sudo rm /etc/systemd/system/RTL.service
sudo rm -r /home/admin/RTL
echo "OK done."
2018-11-04 00:26:45 +01:00
exit 1
fi
2018-11-04 01:02:12 +01:00
echo "*** Dialog ***"
2018-11-04 01:07:26 +01:00
dialog --title "Install: Ride The Lightning Web Interface" --yesno "This is still experimental and very reckless:\nOnce your wallet is unlocked EVERYBODY in your\nLOCAL NETWORK can CONTROL YOUR NODE with RTL!\nDo you really want to install RTL?" 8 50
2018-11-04 01:02:12 +01:00
response = $?
case $response in
1) exit 1 ; ;
esac
2018-11-04 01:16:18 +01:00
clear
2018-11-04 01:02:12 +01:00
2018-10-28 20:49:55 +01:00
# disable RPC listen
# to prevent tls cer auth error
2018-11-04 00:26:45 +01:00
echo "*** Modify lnd.conf ***"
2018-10-28 20:49:55 +01:00
sudo sed -i "s/^rpclisten=0.0.0.0:10009/#rpclisten=0.0.0.0:10009/g" /mnt/hdd/lnd/lnd.conf
sudo systemctl restart lnd
2018-11-04 00:26:45 +01:00
echo ""
2018-10-28 20:49:55 +01:00
# install latest nodejs
2018-11-04 00:26:45 +01:00
echo "*** Install NodeJS ***"
2018-10-28 20:49:55 +01:00
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
2018-11-04 00:26:45 +01:00
echo ""
2018-10-28 20:49:55 +01:00
# close source code
2018-11-04 00:26:45 +01:00
echo "*** Get the RTL Source Code ***"
2018-10-28 20:49:55 +01:00
git clone https://github.com/ShahanaFarooqui/RTL.git
cd RTL
npm install
cd ..
2018-11-04 00:26:45 +01:00
echo ""
2018-10-28 20:49:55 +01:00
# open firewall
2018-11-04 00:26:45 +01:00
echo "*** Updating Firewall ***"
2018-10-28 20:49:55 +01:00
sudo ufw allow 3000
sudo ufw --force enable
2018-11-04 00:26:45 +01:00
echo ""
2018-10-28 20:49:55 +01:00
# install service
2018-11-04 03:11:20 +01:00
echo " *** Install RTL systemd for ${ network } on ${ chain } *** "
2018-10-28 20:49:55 +01:00
sudo cp /home/admin/assets/RTL.service /etc/systemd/system/RTL.service
2018-11-04 03:11:20 +01:00
sudo sed -i " s|chain/bitcoin/mainnet|chain/ ${ network } / ${ chain } net| " /etc/systemd/system/RTL.service
2018-10-28 20:49:55 +01:00
sudo systemctl enable RTL
sudo systemctl start RTL
2018-11-04 00:26:45 +01:00
sleep 2
echo ""
2018-10-28 20:49:55 +01:00
2018-11-04 00:26:45 +01:00
# install service
echo "*** READY ***"
echo "RTL web servcie should be installed and running now."
echo ""
echo "Try to open the following URL in your local webrowser"
echo "and unlock your wallet from there with PASSWORD C."
echo " ---> http:// ${ localip } :3000 "
echo ""
echo "RTL web server will now start with every new boot."
echo "Always unlock your wallet from there now."
2018-11-04 01:02:12 +01:00
echo "Just use RTL from same local network, DONT forward"
2018-11-04 00:26:45 +01:00
echo "port 3000 on your internet router to the RaspiBlitz."
echo ""
echo "Have fun 'Riding the Lightning' (RTL) :D"