2018-08-23 03:08:09 +02:00
#!/bin/bash
2019-04-04 02:51:04 +01:00
clear
2018-08-23 03:08:09 +02:00
2019-02-02 23:49:04 +01:00
# load raspiblitz config data
source /home/admin/raspiblitz.info
2018-12-21 01:59:26 +01:00
source /mnt/hdd/raspiblitz.conf
2018-08-24 20:35:55 +02:00
2019-04-04 01:04:10 +01:00
# default host to local IP & port 10009
2019-04-03 14:47:07 +01:00
host = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
port = "10009"
2018-08-23 03:08:09 +02:00
2019-04-03 14:47:07 +01:00
# change host to dynDNS if set
if [ ${# dynDomain } -gt 0 ] ; then
host = " ${ dynDomain } "
echo " port 10009 forwarding from dynDomain ${ host } "
2018-12-21 01:59:26 +01:00
fi
2019-04-03 14:47:07 +01:00
# check if port 10009 is forwarded
if [ ${# sshtunnel } -gt 0 ] ; then
isForwarded = $( echo ${ sshtunnel } | grep -c "10009<" )
if [ ${ isForwarded } -gt 0 ] ; then
host = $( echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1)
2019-04-03 14:59:19 +01:00
port = $( echo $sshtunnel | awk '{split($0,a,"10009<"); print a[2]}' | cut -d ' ' -f1 | sed 's/[^0-9]//g' )
2019-04-03 14:47:07 +01:00
echo " port 10009 forwarding from port ${ port } from server ${ host } "
else
echo "port 10009 is not part of the ssh forwarding - keep default port 10009"
fi
fi
2019-04-04 01:04:10 +01:00
# write qr code data to text file
echo -e " ${ host } : ${ port } ,\n $( xxd -p -c2000 ./.lnd/data/chain/${ network } /${ chain } net/admin.macaroon) , " > qr.txt
2019-02-24 07:08:33 +01:00
2019-04-04 02:51:04 +01:00
# display qr code on LCD
2019-02-24 07:08:33 +01:00
./XXdisplayQRlcd.sh
2019-04-04 02:51:04 +01:00
# show pairing info
clear
2019-02-24 07:08:33 +01:00
msg = ""
2018-12-21 02:36:24 +01:00
if [ ${# dynDomain } -eq 0 ] ; then
2019-02-24 07:08:33 +01:00
msg = "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
2019-04-04 01:04:10 +01:00
fi
2019-04-04 02:51:04 +01:00
msg = " ${ msg } On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED'\n\n(Or in the App go to --> 'Settings' > 'Connect to your LND Server') \n\nThere you see three 3 form fields to fill out. Skip those and go right to the buttons below.\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and <continue> or <show QR code> to see it in this window. "
2019-02-24 07:08:33 +01:00
whiptail --backtitle "Connecting Shango Mobile Wallet" \
--title "Setup Shango Step 1" \
2019-04-04 02:51:04 +01:00
--yes-button "continue" \
--no-button "show QR code" \
2019-02-24 07:08:33 +01:00
--yesno " ${ msg } " 20 65
2019-04-04 02:51:04 +01:00
if [ $? -eq 1 ] ; then
2019-02-24 07:08:33 +01:00
/home/admin/XXdisplayQR.sh
fi
2019-04-04 01:04:10 +01:00
# clean up
2019-02-24 07:08:33 +01:00
./XXdisplayQRlcd_hide.sh
shred qr.png 2> /dev/null
2019-04-04 02:51:04 +01:00
rm -f qr.png 2> /dev/null
shred qr.txt 2> /dev/null
rm -f qr.txt 2> /dev/null
# follow up dialog
whiptail --backtitle "Connecting Shango Mobile Wallet" \
--title "Press Connect on Shango" \
--msgbox "Now press 'Connect' within the Shango Wallet.\n\nIf its not working - check issues on GitHub:\n\nhttps://github.com/neogeno/shango-lightning-wallet/issues" 15 65