mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-12 21:59:19 +02:00
commit
82d215f321
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 The RaspiBlitz developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -32,7 +32,7 @@ Fastest and cheapest way to get your own Lightning Node running - on a Raspberry
|
||||
**Total Price: 127,31 EUR** (thats under 150 USD)
|
||||
|
||||
Amazon shopping lists for different countries:
|
||||
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [FR](shoppinglist_fr.md) ]
|
||||
[ [USA](shoppinglist_usa.md) ] [ [UK](shoppinglist_uk.md) ] [ [FR](shoppinglist_fr.md) ] [ [China](shoppinglist_cn.md) ]
|
||||
|
||||
You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning thru [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).
|
||||
|
||||
|
@ -179,7 +179,7 @@ echo "*** LITECOIN ***"
|
||||
# based on https://medium.com/@jason.hcwong/litecoin-lightning-with-raspberry-pi-3-c3b931a82347
|
||||
|
||||
# set version (change if update is available)
|
||||
litecoinVersion="0.16.0"
|
||||
litecoinVersion="0.16.2"
|
||||
cd /home/admin/download
|
||||
sudo -u admin wget https://download.litecoin.org/litecoin-${litecoinVersion}/linux/litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz
|
||||
sudo -u admin tar -xvf litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz
|
||||
|
@ -14,6 +14,10 @@ litecoinSize=19180000 # 19184960-tolerance
|
||||
# load network
|
||||
network=`cat .network`
|
||||
|
||||
# make sure lftp is available
|
||||
sudo apt-get install lftp -y
|
||||
echo ""
|
||||
|
||||
# settings based on network
|
||||
list=$bitcoinList
|
||||
url=$bitcoinUrl
|
||||
@ -68,7 +72,7 @@ while :
|
||||
freshSize=0
|
||||
fi
|
||||
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc)
|
||||
echo $progress > '.${name}.progress'
|
||||
echo $progress > ".${name}.progress"
|
||||
|
||||
# detect if since last loop any progress occured
|
||||
if [ ${actualSize} -eq ${freshSize} ]; then
|
||||
@ -97,7 +101,7 @@ while :
|
||||
echo "Its OK to close terminal now and SSH back in later."
|
||||
echo "****************************************************"
|
||||
screen -S ${name} -X hardcopy .${name}.out
|
||||
newScreenDump=$(cat .Download.out | grep . | tail -8)
|
||||
newScreenDump=$(cat .${name}.out | grep . | tail -8)
|
||||
if [ ${#newScreenDump} -gt 0 ]; then
|
||||
screenDump=$newScreenDump
|
||||
fi
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
echo ""
|
||||
|
||||
# *** BITCOIN Torrent ***
|
||||
bitcoinTorrent="raspiblitz-bitcoin-2018-07-16"
|
||||
@ -11,58 +12,165 @@ litecoinTorrentsize=10240000
|
||||
# load network
|
||||
network=`cat .network`
|
||||
|
||||
# make sure lftp is available
|
||||
sudo apt-get install lftp -y
|
||||
echo ""
|
||||
|
||||
# settings based on network
|
||||
torrent=$bitcoinTorrent
|
||||
torrentsize=$bitcoinTorrentsize
|
||||
size=$bitcoinTorrentsize
|
||||
if [ "$network" = "litecoin" ]; then
|
||||
torrent=$litecoinTorrent
|
||||
torrentsize=$litecoinTorrentsize
|
||||
size=$litecoinTorrentsize
|
||||
fi
|
||||
echo ""
|
||||
echo "torrentFile: ${torrent}"
|
||||
|
||||
echo ""
|
||||
echo "*** Downloading TORRENT ***"
|
||||
echo "IN CASE DOWNLOAD DOES NOT START OR TOO SLOW:"
|
||||
echo "CTRL+z start ./10setupBlitz.sh choose other option"
|
||||
echo "***************************"
|
||||
echo ""
|
||||
tmpfile=$(mktemp)
|
||||
chmod a+x $tmpfile
|
||||
echo "killall transmission-cli" > $tmpfile
|
||||
sudo transmission-cli ./assets/$torrent.torrent -D -et -w /mnt/hdd -f $tmpfile
|
||||
echo "OK - Download closed"
|
||||
echo ""
|
||||
# screen background monitoring settings
|
||||
name="Torrent"
|
||||
targetDir="/mnt/hdd/torrent"
|
||||
targetSize=$size
|
||||
maxTimeoutLoops=100000
|
||||
command="sudo lftp -c \"torrent -O ${targetDir} /home/admin/assets/${torrent}.torrent; bye\""
|
||||
|
||||
echo "*** Checking TORRENT ***"
|
||||
echo "wait a moment"
|
||||
sleep 5
|
||||
downloadsize=$(sudo du -s /mnt/hdd/$torrent/ | awk '{print $1}' | tr -dc '0-9')
|
||||
if [ ${#downloadsize} -eq 0 ]; then
|
||||
downloadsize=0
|
||||
# starting session if needed
|
||||
echo "checking if ${name} has a running screen session"
|
||||
screen -wipe 1>/dev/null
|
||||
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
|
||||
echo "isRunning(${isRunning})"
|
||||
if [ ${isRunning} -eq 0 ]; then
|
||||
echo "Starting screen session"
|
||||
sudo mkdir ${targetDir} 2>/dev/null
|
||||
screenCommand="screen -S ${name} -L screen.log -dm ${command}"
|
||||
echo "${screenCommand}"
|
||||
bash -c "${screenCommand}"
|
||||
else
|
||||
echo "Continue screen session"
|
||||
fi
|
||||
# add some tolerance for checking
|
||||
size="$(($size-1024000))"
|
||||
echo "download size is(${downloadsize}) needs to be minimum(${size})"
|
||||
if [ ${downloadsize} -lt ${size} ]; then
|
||||
sleep 3
|
||||
|
||||
# monitor session
|
||||
screenDump="... started ..."
|
||||
actualSize=0
|
||||
timeout=1
|
||||
timeoutInfo="-"
|
||||
while :
|
||||
do
|
||||
|
||||
# check if session is still running
|
||||
screen -wipe 1>/dev/null
|
||||
isRunning=$( screen -S ${name} -ls | grep "${name}" -c )
|
||||
if [ ${isRunning} -eq 0 ]; then
|
||||
timeout=0
|
||||
echo "OK - session finished"
|
||||
break
|
||||
fi
|
||||
|
||||
# calculate progress and write it to file for LCD to read
|
||||
freshSize=$( du -s ${targetDir} | head -n1 | awk '{print $1;}' )
|
||||
if [ ${#actualSize} -eq 0 ]; then
|
||||
freshSize=0
|
||||
fi
|
||||
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc)
|
||||
echo $progress > '.${name}.progress'
|
||||
|
||||
# detect if since last loop any progress occured
|
||||
if [ ${actualSize} -eq ${freshSize} ]; then
|
||||
timeoutInfo="${timeout}/${maxTimeoutLoops}"
|
||||
timeout=$(( $timeout + 1 ))
|
||||
else
|
||||
timeout=1
|
||||
timeoutInfo="no timeout detected"
|
||||
fi
|
||||
actualSize=$freshSize
|
||||
|
||||
# detect if mx timeout loop limit is reached
|
||||
if [ ${timeout} -gt ${maxTimeoutLoops} ]; then
|
||||
echo "FAIL - download hit timeout"
|
||||
break
|
||||
fi
|
||||
|
||||
# display info screen
|
||||
clear
|
||||
echo "****************************************************"
|
||||
echo "Monitoring Screen Session: ${name}"
|
||||
echo "Progress: ${progress}% (${actualSize} of ${targetSize})"
|
||||
echo "Timeout: ${timeoutInfo}"
|
||||
echo "If needed press key x to stop ${name}"
|
||||
echo "NOTICE: This can take multiple hours or days !!"
|
||||
echo "Its OK to close terminal now and SSH back in later."
|
||||
echo "****************************************************"
|
||||
screen -S ${name} -X hardcopy .${name}.out
|
||||
newScreenDump=$(cat .${name}.out | grep . | tail -8)
|
||||
if [ ${#newScreenDump} -gt 0 ]; then
|
||||
screenDump=$newScreenDump
|
||||
fi
|
||||
echo "$screenDump"
|
||||
|
||||
# wait 2 seconds for key input
|
||||
read -n 1 -t 2 keyPressed
|
||||
|
||||
# check if user wants to abort session
|
||||
if [ "${keyPressed}" = "x" ]; then
|
||||
echo ""
|
||||
echo "Aborting ${name}"
|
||||
break
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# clean up
|
||||
rm -f .${name}.out
|
||||
rm -f .${name}.progress
|
||||
|
||||
# quit session if still running
|
||||
if [ ${isRunning} -eq 1 ]; then
|
||||
# get the PID of screen session
|
||||
sessionPID=$(screen -ls | grep "${name}" | cut -d "." -f1 | xargs)
|
||||
echo "killing screen session PID(${sessionPID})"
|
||||
# kill all child processes of screen sceesion
|
||||
sudo pkill -P ${sessionPID}
|
||||
echo "proccesses killed"
|
||||
sleep 3
|
||||
# tell the screen session to quit and wait a bit
|
||||
screen -S ${name} -X quit 1>/dev/null
|
||||
sleep 3
|
||||
echo "cleaning screen"
|
||||
screen -wipe 1>/dev/null
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# the path torrent will download to
|
||||
targetPath="${targetDir}/${torrent}"
|
||||
echo "path to downloaded data is ${targetPath}"
|
||||
|
||||
# calculate progress and write it to file for LCD to read
|
||||
finalSize=$( du -s ${targetDir} 2>/dev/null | head -n1 | awk '{print $1;}' )
|
||||
if [ ${#finalSize} -eq 0 ]; then
|
||||
finalSize=0
|
||||
fi
|
||||
echo "final size is ${finalSize} of targeted size ${targetSize}"
|
||||
|
||||
# check result
|
||||
if [ ${finalSize} -lt ${targetSize} ]; then
|
||||
|
||||
# Download failed
|
||||
sleep 3
|
||||
echo -ne '\007'
|
||||
dialog --title " WARNING " --yesno "The download failed or is not complete. Do you want keep already downloaded data?" 6 57
|
||||
dialog --title " WARNING " --yesno "The download failed or is not complete. Maybe try again (later). Do you want keep already downloaded data for next try?" 8 57
|
||||
response=$?
|
||||
case $response in
|
||||
1) sudo rm -rf /mnt/hdd/$torrent ; sudo rm -rf /root/.config/transmission ;;
|
||||
1) sudo rm -rf ${targetDir} ;;
|
||||
esac
|
||||
./00mainMenu.sh
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "*** Moving Files ***"
|
||||
echo "moving files ..."
|
||||
sudo mv /mnt/hdd/$torrent /mnt/hdd/${network}
|
||||
echo ""
|
||||
# Download worked
|
||||
echo "*** Moving Files ***"
|
||||
sudo mv ${targetPath} /mnt/hdd/${network}
|
||||
echo "OK"
|
||||
|
||||
# set SetupState
|
||||
echo "50" > /home/admin/.setup
|
||||
# continue setup
|
||||
./60finishHDD.sh
|
||||
|
||||
# continue setup
|
||||
./60finishHDD.sh
|
||||
fi
|
@ -4,7 +4,7 @@
|
||||
network=`cat .network`
|
||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
||||
|
||||
command="lncli --chain=${network} --force closeallchannels "
|
||||
command="lncli --chain=${network} closeallchannels --force"
|
||||
|
||||
clear
|
||||
echo "***********************************"
|
||||
|
Loading…
x
Reference in New Issue
Block a user