mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-13 03:30:49 +02:00
whitepaper viewable through terminal (#2238)
This commit is contained in:
parent
1c59fb73eb
commit
1e61cdd901
@ -365,8 +365,8 @@ function notifyme() {
|
|||||||
# command: whitepaper
|
# command: whitepaper
|
||||||
# downloads the whitepaper from the blockchain to /home/admin/bitcoin.pdf
|
# downloads the whitepaper from the blockchain to /home/admin/bitcoin.pdf
|
||||||
function whitepaper() {
|
function whitepaper() {
|
||||||
cd /home/admin/config.scripts
|
cd /home/admin
|
||||||
./bonus.whitepaper.sh on
|
./config.scripts/bonus.whitepaper.sh on
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: qr ["string"]
|
# command: qr ["string"]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
WhitepaperVersion="v0.1"
|
WhitepaperVersion="v0.1"
|
||||||
DownloadPath="/home/admin/"
|
DownloadPath="/home/admin"
|
||||||
WhitepaperFilename="bitcoin.pdf"
|
WhitepaperFilename="/bitcoin.pdf"
|
||||||
|
|
||||||
# command info
|
# command info
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
@ -28,27 +28,30 @@ This service downloads Satoshi's Whitepaper directly from the blockchain.
|
|||||||
When enabled, the Whitepaper is downloaded to $DownloadPath$WhitepaperFilename
|
When enabled, the Whitepaper is downloaded to $DownloadPath$WhitepaperFilename
|
||||||
When disabled, the Whitepaper is deleted from $DownloadPath$WhitepaperFilename
|
When disabled, the Whitepaper is deleted from $DownloadPath$WhitepaperFilename
|
||||||
Also, use the command 'whitepaper' from the command line to download the whitepaper directly.
|
Also, use the command 'whitepaper' from the command line to download the whitepaper directly.
|
||||||
" 11 78
|
From the user home folder, call an editor 'nano bitcoin.pdf' to enter the bitcoin.txt or use 'less bitcoin.txt' command, both to view the file in ASCII format.
|
||||||
|
" 13 78
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# switch on
|
# switch on
|
||||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "# ***"
|
echo "# ***"
|
||||||
echo "# Downloading the Whitepaper to $DownloadPath$WhitepaperFilename..."
|
echo "# Downloading the Whitepaper to $DownloadPath$WhitepaperFilename..."
|
||||||
echo "# ***"
|
echo "# ***"
|
||||||
echo ""
|
echo ""
|
||||||
|
# download from blockchain and transform into pdf
|
||||||
sudo -u bitcoin bitcoin-cli getblock 00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949 0 | tail -c+92167 | for ((o=0;o<946;++o)) ; do read -rN420 x ; echo -n ${x::130}${x:132:130}${x:264:130} ; done | xxd -r -p | tail -c+9 | head -c184292 > $DownloadPath/$WhitepaperFilename
|
sudo -u bitcoin bitcoin-cli getblock 00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949 0 |\
|
||||||
|
tail -c+92167 |\
|
||||||
|
for ((o=0;o<946;++o)) ; do read -rN420 x ; echo -n ${x::130}${x:132:130}${x:264:130} ; done |\
|
||||||
|
xxd -r -p |\
|
||||||
|
tail -c+9 |\
|
||||||
|
head -c184292 > $DownloadPath/$WhitepaperFilename
|
||||||
|
# transfor pdf to txt to view with less through the terminal
|
||||||
|
pdftotext $DownloadPath$WhitepaperFilename
|
||||||
# setting value in raspi blitz config
|
# setting value in raspi blitz config
|
||||||
sudo sed -i "s/^whitepaper=.*/whitepaper=on/g" /mnt/hdd/raspiblitz.conf
|
sudo sed -i "s/^whitepaper=.*/whitepaper=on/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
echo "# OK - Whitepaper downloaded to $DownloadPath$WhitepaperFilename"
|
echo "# OK - Whitepaper downloaded to $DownloadPath$WhitepaperFilename"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -56,7 +59,6 @@ fi
|
|||||||
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||||
isInstalled=1
|
isInstalled=1
|
||||||
if [ ${isInstalled} -eq 1 ]; then
|
if [ ${isInstalled} -eq 1 ]; then
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "# ***"
|
echo "# ***"
|
||||||
echo "# Removing the Whitepaper from $DownloadPath$WhitepaperFilename..."
|
echo "# Removing the Whitepaper from $DownloadPath$WhitepaperFilename..."
|
||||||
@ -64,9 +66,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
# setting value in raspi blitz config
|
# setting value in raspi blitz config
|
||||||
sudo sed -i "s/^whitepaper=.*/whitepaper=off/g" /mnt/hdd/raspiblitz.conf
|
sudo sed -i "s/^whitepaper=.*/whitepaper=off/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
rm $DownloadPath$WhitepaperFilename
|
||||||
rm $DownloadPath/$WhitepaperFilename
|
rm $DownloadPath/bitcoin.txt
|
||||||
|
|
||||||
echo "# OK - Whitepaper removed."
|
echo "# OK - Whitepaper removed."
|
||||||
else
|
else
|
||||||
echo "# The Whitepaper has not been downloaded yet."
|
echo "# The Whitepaper has not been downloaded yet."
|
||||||
|
Loading…
Reference in New Issue
Block a user