Browse Source

fix changed macaroon path

#146
rootzoll 6 years ago
parent
commit
36d4e3e766
  1. 24
      home.admin/00infoBlitz.sh
  2. 17
      home.admin/70initLND.sh
  3. 12
      home.admin/97addMobileWalletShango.sh

24
home.admin/00infoBlitz.sh

@ -9,9 +9,17 @@ color_gray='\033[0;37m'
# 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
# set datadir
bitcoin_dir="/home/bitcoin/.${network}"
lnd_dir="/home/bitcoin/.lnd"
lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
# get uptime & load
load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
@ -56,16 +64,16 @@ network_tx=$(ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[
btc_path=$(command -v ${network}-cli)
if [ -n ${btc_path} ]; then
btc_title=$network
chain="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo | jq -r '.chain')"
if [ -n $chain ]; then
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo)"
if [ -n $blockchaininfo ]; then
btc_title="${btc_title} (${chain}net)"
# get sync status
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount)"
block_verified="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo | jq -r '.blocks')"
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
block_diff=$(expr ${block_chain} - ${block_verified})
progress="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo | jq -r '.verificationprogress')"
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
sync_percentage=$(printf "%.2f%%" "$(echo $progress | awk '{print 100 * $1}')")
if [ ${block_diff} -eq 0 ]; then # fully synced
@ -160,7 +168,7 @@ if [ "$wallet_unlocked" -gt 0 ] ; then
alias_color="${color_red}"
ln_alias="Wallet Locked"
else
ln_getInfo=$(/usr/local/bin/lncli --macaroonpath=${lnd_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
ln_getInfo=$(/usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
ln_external=$(echo "${ln_getInfo}" | grep "uris" -A 1 | tr -d '\n' | cut -d '"' -f4)
alias_color="${color_grey}"
ln_alias=$(echo "${ln_getInfo}" | grep "alias" | cut -d '"' -f4)
@ -177,10 +185,10 @@ else
fi
fi
else
ln_walletbalance="$(/usr/local/bin/lncli --macaroonpath=${lnd_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
ln_channelbalance="$(/usr/local/bin/lncli --macaroonpath=${lnd_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
ln_walletbalance="$(/usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
ln_channelbalance="$(/usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
ln_channels_total="$(/usr/local/bin/lncli --macaroonpath=${lnd_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
ln_channels_total="$(/usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
ln_baseInfo="${color_gray}Wallet (on-chain) ${ln_walletbalance} sat"
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} sat"
fi

17
home.admin/70initLND.sh

@ -108,10 +108,6 @@ echo "walletExists(${walletExists})"
sleep 2
if [ ${walletExists} -eq 0 ]; then
# delete old macaroons if exist
sudo rm /mnt/hdd/lnd/*.macaroon 2>/dev/null
sudo rm /home/admin/.lnd/*.macaroon 2>/dev/null
# setup state signals, that no wallet has been created yet
dialog --backtitle "RaspiBlitz - LND Lightning Wallet (${network}/${chain})" --msgbox "
${network} and Lighthing Services are installed.
@ -168,14 +164,14 @@ sleep 60
###### Copy LND macaroons to admin
echo ""
echo "*** Copy LND Macaroons to user admin ***"
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/admin.macaroon | grep -c admin.macaroon)
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/${network}/${chain}net/admin.macaroon | grep -c admin.macaroon)
if [ ${macaroonExists} -eq 0 ]; then
./AAunlockLND.sh
sleep 3
fi
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/admin.macaroon | grep -c admin.macaroon)
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/${network}/${chain}net/admin.macaroon | grep -c admin.macaroon)
if [ ${macaroonExists} -eq 0 ]; then
sudo -u bitcoin ls -la /home/bitcoin/.lnd/admin.macaroon
sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/${network}/${chain}net/admin.macaroon
echo ""
echo "FAIL - LND Macaroons not created"
echo "Please check the following LND issue:"
@ -184,11 +180,14 @@ if [ ${macaroonExists} -eq 0 ]; then
exit 1
fi
sudo mkdir /home/admin/.lnd 2>/dev/null
macaroonExists=$(sudo ls -la /home/admin/.lnd/ | grep -c admin.macaroon)
macaroonExists=$(sudo ls -la /home/admin/data/${network}/${chain}net/.lnd/ | grep -c admin.macaroon)
if [ ${macaroonExists} -eq 0 ]; then
sudo mkdir /home/admin/.lnd
sudo mkdir /home/admin/.lnd/data
sudo mkdir /home/admin/.lnd/${network}
sudo mkdir /home/admin/.lnd/${network}/${chain}net
sudo cp /home/bitcoin/.lnd/tls.cert /home/admin/.lnd
sudo cp /home/bitcoin/.lnd/admin.macaroon /home/admin/.lnd
sudo cp /home/bitcoin/.lnd/data/${network}/${chain}net/admin.macaroon /home/admin/data/${network}/${chain}net/.lnd
sudo chown -R admin:admin /home/admin/.lnd/
echo "OK - LND Macaroons created"
else

12
home.admin/97addMobileWalletShango.sh

@ -1,5 +1,15 @@
#!/bin/bash
# load network
network=`cat .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
# make sure qrcode-encoder in installed
clear
echo "*** Setup ***"
@ -36,7 +46,7 @@ read key
clear
echo "*** STEP 2 : SCAN MACAROON (make whole QR code fill camera) ***"
qrencode $(xxd -p -c3000 /home/admin/.lnd/admin.macaroon) -t ANSIUTF8
qrencode $(xxd -p -c3000 /home/admin/.lnd/data/${network}/${chain}net/admin.macaroon) -t ANSIUTF8
echo "Press ENTER to make RaspiBlitz displaying the TLS-CERT QR code ..."
echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER for next step."
read key

Loading…
Cancel
Save