diff --git a/home.admin/00torMenu.sh b/home.admin/00torMenu.sh index 4d19de460..781c9e8cd 100644 --- a/home.admin/00torMenu.sh +++ b/home.admin/00torMenu.sh @@ -24,8 +24,14 @@ fi echo "Run dialog ..." echo "Installing the QR code generator (qrencode)" -./XXaptInstall.sh qrencode -./XXaptInstall.sh fbi + +# Make sure needed packages are installed +if [ $(sudo dpkg-query -l | grep "ii fbi" | wc -l) = 0 ]; then + sudo apt-get install fbi -y > /dev/null +fi +if [ $(sudo dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then + sudo apt-get install qrencode -y > /dev/null +fi # BASIC MENU INFO HEIGHT=14 diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 3496c8ceb..92f1cc556 100755 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -117,7 +117,7 @@ case $CHOICE in /home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink} fi /home/admin/config.scripts/blitz.lcd.sh hide - /home/admin/config.scripts/bonus.lndconnect.sh REST + /home/admin/config.scripts/bonus.lndconnect.sh RPC exit 1; ;; ZAP_ANDROID) diff --git a/home.admin/97addMobileWalletShango.sh b/home.admin/97addMobileWalletShango.sh index a4e6ed4c2..863938cce 100755 --- a/home.admin/97addMobileWalletShango.sh +++ b/home.admin/97addMobileWalletShango.sh @@ -31,10 +31,10 @@ if [ ${#sshtunnel} -gt 0 ]; then fi # write qr code data to text file -echo -e "${host}:${port},\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon),\n$(openssl x509 -sha256 -fingerprint -in ./.lnd/tls.cert -noout)" > qr.txt +qrcodedata=$("${host}:${port},\n$(xxd -p -c2000 ./.lnd/data/chain/${network}/${chain}net/admin.macaroon),\n$(openssl x509 -sha256 -fingerprint -in ./.lnd/tls.cert -noout)") # display qr code on LCD -./XXdisplayQRlcd.sh +/home/admin/config.scripts/blitz.lcd.sh qr "${qrcodedata}" # show pairing info clear @@ -49,11 +49,11 @@ whiptail --backtitle "Connecting Shango Mobile Wallet" \ --no-button "show QR code" \ --yesno "${msg}" 20 70 if [ $? -eq 1 ]; then - /home/admin/XXdisplayQR.sh + /home/admin/config.scripts/blitz.lcd.sh qr-console "${qrcodedata}" fi # clean up -./XXdisplayQRlcd_hide.sh +/home/admin/config.scripts/blitz.lcd.sh hide shred qr.png 2> /dev/null rm -f qr.png 2> /dev/null shred qr.txt 2> /dev/null diff --git a/home.admin/97addMobileWalletTor.sh b/home.admin/97addMobileWalletTor.sh index 5edb1051b..47cb4de86 100644 --- a/home.admin/97addMobileWalletTor.sh +++ b/home.admin/97addMobileWalletTor.sh @@ -42,8 +42,9 @@ echo "Press ENTER to continue, CTRL+C to cancel." echo "" read key -./XXdisplayQRlcd_hide.sh +/home/admin/config.scripts/blitz.lcd.sh hide +cd /home/admin # write QR code to image if [ $1 == zeus ]; then lndconnect --host=$(sudo cat /mnt/hdd/tor/lnd_REST/hostname) --port=8080 --image @@ -51,7 +52,7 @@ elif [ $1 == zap ]; then lndconnect --host=$(sudo cat /mnt/hdd/tor/lnd_REST/hostname) --port=8080 --nocert --image fi # display qr code image on LCD -./XXdisplayLCD.sh lndconnect-qr.png +/home/admin/config.scripts/blitz.lcd.sh image /home/admin/lndconnect-qr.png # show pairing info dialog msg="" msg="You should now see the pairing QR code on the RaspiBlitz LCD.\n\n${msg}When you start the App choose to connect to your own node.\n(DIY / Remote-Node / lndconnect)\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and or to see it in this window." @@ -71,7 +72,7 @@ if [ $? -eq 1 ]; then fi # clean up -./XXdisplayQRlcd_hide.sh +/home/admin/config.scripts/blitz.lcd.sh hide shred lndconnect-qr.png 2> /dev/null rm -f lndconnect-qr.png 2> /dev/null shred qr.txt 2> /dev/null diff --git a/home.admin/BBcreateInvoice.sh b/home.admin/BBcreateInvoice.sh index baa435280..971e4a9c5 100755 --- a/home.admin/BBcreateInvoice.sh +++ b/home.admin/BBcreateInvoice.sh @@ -61,23 +61,21 @@ if [ ${#error} -gt 0 ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "${error}" else -# echo "******************************" -# echo "WIN" -# echo "******************************" -# echo "${result}" rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4) payReq=$(echo "$result" | grep pay_req | cut -d '"' -f4) - echo -e "${payReq}" > qr.txt - ./XXdisplayQRlcd.sh + /home/admin/config.scripts/blitz.lcd.sh qr "${payReq}" + + if [ $(sudo dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then + sudo apt-get install qrencode -y > /dev/null + fi echo echo "********************" echo "Here is your invoice" echo "********************" echo - ./XXaptInstall.sh qrencode - qrencode -t ANSI256 < /home/admin/qr.txt + qrencode -t ANSI256 "${payReq}" echo echo "Give this Invoice/PaymentRequest to someone to pay it:" echo @@ -97,8 +95,8 @@ else echo $result echo echo "Returning to menu - OK Invoice payed." - /home/admin/XXdisplayQRlcd_hide.sh - /home/admin/XXdisplayLCD.sh /home/admin/raspiblitz/pictures/ok.png + /home/admin/config.scripts/blitz.lcd.sh hide + /home/admin/config.scripts/blitz.lcd.sh image /home/admin/raspiblitz/pictures/ok.png sleep 2 break fi @@ -117,8 +115,6 @@ else done - /home/admin/XXdisplayQRlcd_hide.sh - shred qr.txt - rm -f qr.txt + /home/admin/config.scripts/blitz.lcd.sh hide fi \ No newline at end of file diff --git a/home.admin/BBfundWallet.sh b/home.admin/BBfundWallet.sh index c88f2a681..09bfd8871 100755 --- a/home.admin/BBfundWallet.sh +++ b/home.admin/BBfundWallet.sh @@ -55,8 +55,7 @@ if [ "$chain" = "test" ]; then fi echo "generating QR code ... please wait" -echo -e "$network:${address}" > qr.txt -/home/admin/XXdisplayQRlcd.sh +/home/admin/config.scripts/blitz.lcd.sh qr "$network:${address}" # dialog with instructions while QR code is shown on LCD whiptail --backtitle "Fund your on chain wallet" \ @@ -67,13 +66,11 @@ whiptail --backtitle "Fund your on chain wallet" \ # display QR code if [ $? -eq 1 ]; then - /home/admin/XXdisplayQR.sh + /home/admin/config.scripts/blitz.lcd.sh qr-console "$network:${address}" fi # clean up -shred qr.txt -rm -f qr.txt -/home/admin/XXdisplayQRlcd_hide.sh +/home/admin/config.scripts/blitz.lcd.sh hide # follow up info whiptail --backtitle "Fund your on chain wallet" \ diff --git a/home.admin/XXaptInstall.sh b/home.admin/XXaptInstall.sh deleted file mode 100755 index 2adc88d28..000000000 --- a/home.admin/XXaptInstall.sh +++ /dev/null @@ -1,4 +0,0 @@ -# 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 diff --git a/home.admin/XXdisplayLCD.sh b/home.admin/XXdisplayLCD.sh deleted file mode 100755 index 868c07af7..000000000 --- a/home.admin/XXdisplayLCD.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/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 diff --git a/home.admin/XXdisplayQR.sh b/home.admin/XXdisplayQR.sh deleted file mode 100755 index f7d6cb0be..000000000 --- a/home.admin/XXdisplayQR.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 diff --git a/home.admin/XXdisplayQRlcd.sh b/home.admin/XXdisplayQRlcd.sh deleted file mode 100755 index 1aa7ad274..000000000 --- a/home.admin/XXdisplayQRlcd.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 diff --git a/home.admin/XXdisplayQRlcd_hide.sh b/home.admin/XXdisplayQRlcd_hide.sh deleted file mode 100755 index 98a6782f0..000000000 --- a/home.admin/XXdisplayQRlcd_hide.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -sudo killall -3 fbi -shred /home/admin/qr.png 2> /dev/null -rm -f /home/admin/qr.png 2> /dev/null