mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-28 04:26:28 +02:00
Add option to display QR-code for funding #334
This commit is contained in:
@@ -6,7 +6,8 @@ source /home/admin/_version.info
|
|||||||
# set colors
|
# set colors
|
||||||
color_red='\033[0;31m'
|
color_red='\033[0;31m'
|
||||||
color_green='\033[0;32m'
|
color_green='\033[0;32m'
|
||||||
color_yellow='\033[0;33m'
|
color_amber='\033[0;33m'
|
||||||
|
color_yellow='\033[1;93m'
|
||||||
color_gray='\033[0;37m'
|
color_gray='\033[0;37m'
|
||||||
color_purple='\033[0;35m'
|
color_purple='\033[0;35m'
|
||||||
|
|
||||||
@@ -174,19 +175,11 @@ else
|
|||||||
if [ $public_check = "0" ]; then
|
if [ $public_check = "0" ]; then
|
||||||
public=""
|
public=""
|
||||||
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
||||||
public_color="${color_yellow}"
|
public_color="${color_amber}"
|
||||||
else
|
else
|
||||||
public=""
|
public=""
|
||||||
public_color="${color_red}"
|
public_color="${color_red}"
|
||||||
fi
|
fi
|
||||||
if [ ${#public_addr} -gt 25 ]; then
|
|
||||||
# if a IPv6 address dont show peers to save space
|
|
||||||
networkConnectionsInfo=""
|
|
||||||
fi
|
|
||||||
if [ ${#public_addr} -gt 35 ]; then
|
|
||||||
# if a LONG IPv6 address dont show "Public" in front to save space
|
|
||||||
public_addr_pre=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# DynDNS
|
# DynDNS
|
||||||
if [ ${#dynDomain} -gt 0 ]; then
|
if [ ${#dynDomain} -gt 0 ]; then
|
||||||
@@ -196,14 +189,22 @@ else
|
|||||||
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
|
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
|
||||||
public_color="${color_red}"
|
public_color="${color_red}"
|
||||||
else
|
else
|
||||||
public_color="${color_yellow}"
|
public_color="${color_amber}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# replace IP display with dynDNS
|
# replace IP display with dynDNS
|
||||||
public_addr_pre="DynDNS "
|
public_addr_pre="DynDNS "
|
||||||
networkConnectionsInfo=""
|
|
||||||
public_addr="${dynDomain}"
|
public_addr="${dynDomain}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${#public_addr} -gt 25 ]; then
|
||||||
|
# if a IPv6 address dont show peers to save space
|
||||||
|
networkConnectionsInfo=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${#public_addr} -gt 35 ]; then
|
||||||
|
# if a LONG IPv6 address dont show "Public" in front to save space
|
||||||
|
public_addr_pre=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -230,7 +231,7 @@ else
|
|||||||
public_check=$(nc -z -w6 ${public_ip} 9735 2>/dev/null; echo $?)
|
public_check=$(nc -z -w6 ${public_ip} 9735 2>/dev/null; echo $?)
|
||||||
if [ $public_check = "0" ]; then
|
if [ $public_check = "0" ]; then
|
||||||
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
||||||
ln_publicColor="${color_yellow}"
|
ln_publicColor="${color_amber}"
|
||||||
else
|
else
|
||||||
ln_publicColor="${color_red}"
|
ln_publicColor="${color_red}"
|
||||||
fi
|
fi
|
||||||
@@ -269,20 +270,20 @@ printf "
|
|||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow} ${color_yellow}%s ${color_green} ${ln_alias}
|
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias}
|
||||||
${color_yellow} ${color_gray}${network} Fullnode + Lightning Network ${torInfo}
|
${color_yellow} ${color_gray}${network} Fullnode + Lightning Network ${torInfo}
|
||||||
${color_yellow} ,/ ${color_yellow}%s
|
${color_yellow} / ${color_amber}%s
|
||||||
${color_yellow} ,'/ ${color_gray}%s, CPU %s°C
|
${color_yellow} // ${color_gray}%s, CPU %s°C
|
||||||
${color_yellow} ,' / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}%s
|
${color_yellow} / / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}%s
|
||||||
${color_yellow} ,' /_____, ${color_gray}ssh admin@${color_green}${local_ip}${color_gray} ▼${network_rx} ▲${network_tx}
|
${color_yellow} / /______ ${color_gray}ssh admin@${color_green}${local_ip}${color_gray} ▼${network_rx} ▲${network_tx}
|
||||||
${color_yellow} .'____ ,' ${color_gray}${webinterfaceInfo}
|
${color_yellow} /_____ / ${color_gray}${webinterfaceInfo}
|
||||||
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} (%s)
|
${color_yellow} / / ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} (%s)
|
||||||
${color_yellow} / ,' ${color_gray}${public_addr_pre}${public_color}${public_addr} ${public}${networkConnectionsInfo}
|
${color_yellow} / / ${color_gray}${public_addr_pre}${public_color}${public_addr} ${public}${networkConnectionsInfo}
|
||||||
${color_yellow} /,' ${color_gray}
|
${color_yellow} // ${color_gray}
|
||||||
${color_yellow} /' ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
|
${color_yellow} / ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
|
||||||
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow}${ln_publicColor}${ln_external}
|
${color_gray}${ln_publicColor}${ln_external}
|
||||||
|
|
||||||
" \
|
" \
|
||||||
"RaspiBlitz v${codeVersion}" \
|
"RaspiBlitz v${codeVersion}" \
|
||||||
|
49
home.admin/97addMobileWallet.sh
Normal file → Executable file
49
home.admin/97addMobileWallet.sh
Normal file → Executable file
@@ -6,7 +6,7 @@ source /mnt/hdd/raspiblitz.conf
|
|||||||
|
|
||||||
# check if dynamic domain is set
|
# check if dynamic domain is set
|
||||||
if [ ${#dynDomain} -eq 0 ]; then
|
if [ ${#dynDomain} -eq 0 ]; then
|
||||||
dialog --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz
|
whiptail --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz
|
||||||
also from outside your local network you need to
|
also from outside your local network you need to
|
||||||
activate 'Services' -> 'DynamicDNS' FIRST.
|
activate 'Services' -> 'DynamicDNS' FIRST.
|
||||||
|
|
||||||
@@ -25,17 +25,56 @@ fi
|
|||||||
|
|
||||||
# Basic Options
|
# Basic Options
|
||||||
OPTIONS=(ZAP "Zap Wallet (iOS)" \
|
OPTIONS=(ZAP "Zap Wallet (iOS)" \
|
||||||
SHANGO "Shango Wallet (iOS/Android)" \
|
ZEUS "Zeus Wallet (iOS/Android)"
|
||||||
ZEUS "Zeus Wallet (iOS/Android)")
|
SHANGO_IOS "Shango Wallet for iOS"
|
||||||
|
SHANGO_ANDROID "Shango Wallet for Android"
|
||||||
|
)
|
||||||
|
|
||||||
CHOICE=$(dialog --clear --title "Choose Mobile Wallet" --menu "" 10 40 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 15 50 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
./XXdisplayQRlcd_hide.sh
|
||||||
|
|
||||||
clear
|
clear
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
CLOSE)
|
CLOSE)
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
SHANGO)
|
SHANGO_IOS)
|
||||||
|
echo "https://testflight.apple.com/join/WwCjFnS8" > qr.txt
|
||||||
|
./XXdisplayLCD.sh /home/admin/assets/install_shango.jpg
|
||||||
|
|
||||||
|
whiptail --title "Install Testflight and Shango on your iOS device" \
|
||||||
|
--yes-button "show link as QR" \
|
||||||
|
--no-button "continue" \
|
||||||
|
--yesno "At the moment this app is in public beta testing:\n\nhttps://testflight.apple.com/join/WwCjFnS8" 20 60
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
/home/admin/XXdisplayQR.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
shred qr.txt
|
||||||
|
rm -f qr.txt
|
||||||
|
/home/admin/XXdisplayQRlcd_hide.sh
|
||||||
|
|
||||||
|
./97addMobileWalletShango.sh
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
SHANGO_ANDROID)
|
||||||
|
echo "https://play.google.com/apps/testing/com.shango" > qr.txt
|
||||||
|
./XXdisplayQRlcd.sh
|
||||||
|
whiptail --title "Install Shango on your Android Phone" \
|
||||||
|
--yes-button "show link as QR" \
|
||||||
|
--no-button "continue" \
|
||||||
|
--yesno "At the moment this app is in public beta testing:\n\nhttps://play.google.com/apps/testing/com.shango \n\nDo you want to see a QR code with an Playstore link?" 20 60
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
/home/admin/XXdisplayQR.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
shred qr.txt
|
||||||
|
rm -f qr.txt
|
||||||
|
/home/admin/XXdisplayQRlcd_hide.sh
|
||||||
|
|
||||||
./97addMobileWalletShango.sh
|
./97addMobileWalletShango.sh
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
|
59
home.admin/97addMobileWalletShango.sh
Normal file → Executable file
59
home.admin/97addMobileWalletShango.sh
Normal file → Executable file
@@ -4,10 +4,7 @@
|
|||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
# make sure qrcode-encoder in installed
|
|
||||||
clear
|
clear
|
||||||
echo "*** Setup ***"
|
|
||||||
sudo apt-get install qrencode -y
|
|
||||||
|
|
||||||
# get local IP
|
# get local IP
|
||||||
myip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
myip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||||
@@ -17,39 +14,33 @@ if [ ${#dynDomain} -gt 0 ]; then
|
|||||||
myip="${dynDomain}"
|
myip="${dynDomain}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
#echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && cat ./.lnd/tls.cert >>qr.txt
|
||||||
echo "******************************"
|
echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt
|
||||||
echo "Connect Shango Mobile Wallet"
|
|
||||||
echo "******************************"
|
./XXdisplayQRlcd.sh
|
||||||
echo ""
|
|
||||||
echo "GETTING THE APP"
|
msg=""
|
||||||
echo "At the moment this app is in public beta testing:"
|
|
||||||
echo "iOS: Read https://testflight.apple.com/join/WwCjFnS8 (open on device)"
|
|
||||||
echo "Android: https://play.google.com/apps/testing/com.shango (open on device)"
|
|
||||||
echo ""
|
|
||||||
echo "*** STEP 1 ***"
|
|
||||||
if [ ${#dynDomain} -eq 0 ]; then
|
if [ ${#dynDomain} -eq 0 ]; then
|
||||||
echo "Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
|
msg="Once you have the app is running make sure you are on the same local network (WLAN same as LAN)."
|
||||||
fi
|
fi
|
||||||
echo "On Setup Step 'Choose LND Server Type' connect to 'DIY SELF HOSTED'"
|
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> to see it in this window."
|
||||||
echo "(Or in the App go to --> 'Settings' > 'Connect to your LND Server')"
|
|
||||||
echo "There you see three 3 form fields to fill out. Skip those and go right to the buttons below."
|
|
||||||
echo ""
|
|
||||||
echo "Click on the 'Scan QR' button"
|
|
||||||
echo "Make the this terminal as big as possible - fullscreen would be best."
|
|
||||||
echo "Then PRESS ENTER here in the terminal to generare the QR code and scan it with the app."
|
|
||||||
read key
|
|
||||||
|
|
||||||
clear
|
whiptail --backtitle "Connecting Shango Mobile Wallet" \
|
||||||
echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***"
|
--title "Setup Shango Step 1" \
|
||||||
#echo -e "${myip}:10009,\n$(xxd -p -c2000 ~/.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSIUTF8 < qr.txt
|
--yes-button "show QR" \
|
||||||
echo -e "${myip}:10009,\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon)," > qr.txt && qrencode -t ANSI256 < qr.txt
|
--no-button "continue" \
|
||||||
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished."
|
--yesno "${msg}" 20 65
|
||||||
read key
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
/home/admin/XXdisplayQR.sh
|
||||||
|
fi
|
||||||
shred qr.txt
|
shred qr.txt
|
||||||
|
rm -f qr.txt
|
||||||
|
|
||||||
clear
|
whiptail --backtitle "Connecting Shango Mobile Wallet" \
|
||||||
echo "Now press 'Connect' within the Shango Wallet."
|
--title "Press Connect on Shango" \
|
||||||
echo "If its not working - check issues on GitHub:"
|
--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
|
||||||
echo "https://github.com/neogeno/shango-lightning-wallet/issues"
|
|
||||||
echo ""
|
./XXdisplayQRlcd_hide.sh
|
||||||
|
shred qr.png 2> /dev/null
|
||||||
|
rm -f qr.png
|
||||||
|
@@ -13,29 +13,9 @@ if [ ${#chain} -eq 0 ]; then
|
|||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
# Check if ready (chain in sync and channels open)
|
||||||
echo "*** Precheck ***"
|
./XXchainInSync.sh $network $chain
|
||||||
|
if [ $? != 0 ]; then
|
||||||
# check if chain is in sync
|
|
||||||
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
|
||||||
if [ ${chainInSync} -eq 0 ]; then
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
|
||||||
echo "Wait until chain is sync with LND and try again."
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check number of connected peers
|
|
||||||
echo "check for open channels"
|
|
||||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
|
|
||||||
if [ ${openChannels} -eq 0 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -51,6 +31,8 @@ if [ ${#amount} -eq 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO let user enter a description
|
||||||
|
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
|
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
|
||||||
|
|
||||||
@@ -79,20 +61,48 @@ if [ ${#error} -gt 0 ]; then
|
|||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "${error}"
|
echo "${error}"
|
||||||
else
|
else
|
||||||
echo "******************************"
|
# echo "******************************"
|
||||||
echo "WIN"
|
# echo "WIN"
|
||||||
echo "******************************"
|
# echo "******************************"
|
||||||
echo "${result}"
|
# echo "${result}"
|
||||||
echo ""
|
|
||||||
|
|
||||||
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
|
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
|
||||||
payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4)
|
payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4)
|
||||||
|
echo -e "${payReq}" > qr.txt
|
||||||
|
./XXdisplayQRlcd.sh
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "********************"
|
||||||
|
echo "Here is your invoice"
|
||||||
|
echo "********************"
|
||||||
|
echo
|
||||||
echo "Give this Invoice/PaymentRequest to someone to pay it:"
|
echo "Give this Invoice/PaymentRequest to someone to pay it:"
|
||||||
echo ""
|
echo
|
||||||
echo ${payReq}
|
echo "${payReq}"
|
||||||
echo ""
|
echo
|
||||||
echo "You can use 'lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}' to check the payment. "
|
echo "Do you want to see the invoice QR-code in this terminal? (Y/N)"
|
||||||
|
|
||||||
# TODO: Offer to go into monitor for incommin payment loop.
|
|
||||||
|
|
||||||
|
read -n1 key
|
||||||
|
if [ "$key" = "y" ]; then
|
||||||
|
/home/admin/XXdisplayQR.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
shred qr.txt
|
||||||
|
rm -f qr.txt
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo "************"
|
||||||
|
echo "What's next?"
|
||||||
|
echo "************"
|
||||||
|
echo
|
||||||
|
echo "You can use"
|
||||||
|
echo
|
||||||
|
echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}"
|
||||||
|
echo
|
||||||
|
echo "to check the payment."
|
||||||
|
|
||||||
|
/home/admin/XXdisplayQRlcd_hide.sh
|
||||||
|
# TODO: Offer to go into monitor for incommin payment loop.
|
||||||
|
# Or simply start the loop and show success status when payment occured
|
||||||
fi
|
fi
|
||||||
echo ""
|
|
@@ -56,15 +56,29 @@ if [ "$chain" = "test" ]; then
|
|||||||
coininfo="TESTNET Bitcoin"
|
coininfo="TESTNET Bitcoin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# output info
|
msg="Send ${coininfo} to address --> ${address}\n\nScan the QR code on the LCD with your mobile wallet or copy paste the address."
|
||||||
echo ""
|
|
||||||
echo "******************************"
|
|
||||||
echo "TODO"
|
|
||||||
echo "******************************"
|
|
||||||
echo "Send ${coininfo} to address --> ${address}"
|
|
||||||
if [ "$chain" = "test" ]; then
|
if [ "$chain" = "test" ]; then
|
||||||
echo "get some testnet coins from https://testnet-faucet.mempool.co"
|
msg="${msg} \n\n Get some testnet coins from https://testnet-faucet.mempool.co"
|
||||||
fi
|
fi
|
||||||
echo "Whats next? --> Wait for confirmations. You can use info on LCD to check if funds have arrived."
|
|
||||||
echo "If you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
|
echo -e "$network:${address}" > qr.txt
|
||||||
echo ""
|
/home/admin/XXdisplayQRlcd.sh
|
||||||
|
|
||||||
|
whiptail --backtitle "Fund your on chain wallet" \
|
||||||
|
--title "Send ${coininfo}" \
|
||||||
|
--yes-button "show QR" \
|
||||||
|
--no-button "continue" \
|
||||||
|
--yesno "${msg} \n\n Do you want to see the QR-code for ${coininfo}:${address} in this window?" 0 0
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
/home/admin/XXdisplayQR.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
shred qr.txt
|
||||||
|
rm -f qr.txt
|
||||||
|
|
||||||
|
whiptail --backtitle "Fund your on chain wallet" \
|
||||||
|
--title "What's next?" \
|
||||||
|
--msgbox "Wait for confirmations. \n\nYou can use info on LCD to check if funds have arrived. \n\nIf you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" 0 0
|
||||||
|
|
||||||
|
/home/admin/XXdisplayQRlcd_hide.sh
|
||||||
|
@@ -12,31 +12,9 @@ if [ ${#chain} -eq 0 ]; then
|
|||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
# Check if ready (chain in sync and channels open)
|
||||||
echo "*** Precheck ***"
|
./XXchainInSync.sh $network $chain
|
||||||
echo "please wait a moment ..."
|
if [ $? != 0 ]; then
|
||||||
|
|
||||||
# check if chain is in sync
|
|
||||||
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
|
||||||
if [ ${chainInSync} -eq 0 ]; then
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
|
||||||
echo "Wait until chain is sync with LND and try again."
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# check number of connected peers
|
|
||||||
echo "check for open channels"
|
|
||||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
|
|
||||||
if [ ${openChannels} -eq 0 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
4
home.admin/XXaptInstall.sh
Executable file
4
home.admin/XXaptInstall.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
# Installs package if not yet installed
|
||||||
|
if [ $(sudo dpkg-query -l | grep "ii $1" | wc -l) = 0 ]; then
|
||||||
|
sudo apt-get install $1 -y > /dev/null
|
||||||
|
fi
|
37
home.admin/XXchainInSync.sh
Executable file
37
home.admin/XXchainInSync.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Check if lnd is synced to chain and channels are open
|
||||||
|
# If it isn't, wait until it is
|
||||||
|
# exits with 1 if it isn't.
|
||||||
|
|
||||||
|
network=$1
|
||||||
|
chain=$2
|
||||||
|
|
||||||
|
# check if chain is in sync
|
||||||
|
cmdChainInSync="lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c"
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
while [ $chainInSync -eq 0 ]; do
|
||||||
|
dialog --title "Fail: not in sync" \
|
||||||
|
--ok-label "Try now" \
|
||||||
|
--cancel-label "Give up" \
|
||||||
|
--pause "\n\n'lncli getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||||
|
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
done
|
||||||
|
|
||||||
|
# check number of connected peers
|
||||||
|
echo "check for open channels"
|
||||||
|
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
|
||||||
|
if [ ${openChannels} -eq 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
8
home.admin/XXdisplayLCD.sh
Executable file
8
home.admin/XXdisplayLCD.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Display an image on the LCD
|
||||||
|
|
||||||
|
# make sure fbi is installed
|
||||||
|
./XXaptInstall.sh fbi
|
||||||
|
|
||||||
|
sudo fbi -a -T 1 -d /dev/fb1 --noverbose $1 2> /dev/null
|
24
home.admin/XXdisplayQR.sh
Executable file
24
home.admin/XXdisplayQR.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Display a QR code for the string in qr.txt
|
||||||
|
|
||||||
|
# make sure qrcode-encode and fbi are installed
|
||||||
|
#clear
|
||||||
|
#echo "*** Setup ***"
|
||||||
|
|
||||||
|
echo 50 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
|
||||||
|
./XXaptInstall.sh qrencode
|
||||||
|
echo 90 | whiptail --title "Installing" --backtitle "QR-Code" --gauge "please wait" 4 40 100
|
||||||
|
./XXaptInstall.sh fbi
|
||||||
|
|
||||||
|
whiptail --title "Get ready" --backtitle "QR-Code in Terminal Window" \
|
||||||
|
--msgbox "Make this terminal window as large as possible - fullscreen would be best. \n\nThe QR-Code might be too large for your display. In that case, shrink the letters by pressing the keys Ctrl and Minus (or Cmd and Minus if you are on a Mac) \n\nPRESS ENTER when you are ready to see the QR-code." 20 60
|
||||||
|
|
||||||
|
clear
|
||||||
|
qrencode -t ANSI256 < /home/admin/qr.txt
|
||||||
|
shred /home/admin/qr.txt
|
||||||
|
rm -f /home/admin/qr.txt
|
||||||
|
echo "(To shrink QR code: macOS press CMD- / LINUX press CTRL-) Press ENTER when finished."
|
||||||
|
read key
|
||||||
|
|
||||||
|
clear
|
10
home.admin/XXdisplayQRlcd.sh
Executable file
10
home.admin/XXdisplayQRlcd.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Display a QR code for the string in qr.txt
|
||||||
|
|
||||||
|
# make sure qrcode-encode and fbi are installed
|
||||||
|
./XXaptInstall.sh qrencode
|
||||||
|
./XXaptInstall.sh fbi
|
||||||
|
|
||||||
|
qrencode -l L -o /home/admin/qr.png < /home/admin/qr.txt > /dev/null
|
||||||
|
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null
|
4
home.admin/XXdisplayQRlcd_hide.sh
Executable file
4
home.admin/XXdisplayQRlcd_hide.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sudo killall -3 fbi
|
||||||
|
shred /home/admin/qr.png 2> /dev/null
|
||||||
|
rm -f /home/admin/qr.png 2> /dev/null
|
BIN
home.admin/assets/install_shango.jpg
Normal file
BIN
home.admin/assets/install_shango.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
Reference in New Issue
Block a user