#989 move optional litecoin install to setup

This commit is contained in:
rootzoll 2020-01-20 21:05:40 +01:00
parent abc935fc6d
commit a275e7a3ef
5 changed files with 80 additions and 45 deletions

View File

@ -447,38 +447,6 @@ if [ ${installed} -lt 1 ]; then
exit 1
fi
if [ "${baseImage}" = "raspbian" ]; then
echo ""
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.17.1"
litecoinSHA256="7e6f5a1f0b190de01aa20ecf5c5a2cc5a64eb7ede0806bcba983bcd803324d8a"
cd /home/admin/download
# download
binaryName="litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz"
sudo -u admin wget https://download.litecoin.org/litecoin-${litecoinVersion}/linux/${binaryName}
# check download
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
if [ "${binaryChecksum}" != "${litecoinSHA256}" ]; then
echo "!!! FAIL !!! Downloaded LITECOIN BINARY not matching SHA256 checksum: ${litecoinSHA256}"
exit 1
fi
# install
sudo -u admin tar -xvf ${binaryName}
sudo install -m 0755 -o root -g root -t /usr/local/bin litecoin-${litecoinVersion}/bin/*
installed=$(sudo -u admin litecoind --version | grep "${litecoinVersion}" -c)
if [ ${installed} -lt 1 ]; then
echo ""
echo "!!! BUILD FAILED --> Was not able to install litecoind version(${litecoinVersion})"
exit 1
fi
fi
# "*** LND ***"
## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd
## see LND releases: https://github.com/lightningnetwork/lnd/releases

View File

@ -375,16 +375,7 @@ case $CHOICE in
exit 1;
;;
LITECOIN)
# set network info
sed -i "s/^network=.*/network=litecoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/litecoin.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/litecoin.conf
fi
/home/admin/config.scripts/blitz.litecoin.sh on
/home/admin/10setupBlitz.sh
exit 1;
;;

View File

@ -59,7 +59,6 @@ else
echo "Baseimage is not raspbian (${isRaspbian}), skipping the sd card size check." >> ${logFile}
fi
# import config values
sudo chmod 777 ${configFile}
source ${configFile}
@ -71,6 +70,12 @@ source ${configFile}
echo "### BASIC SYSTEM SETTINGS ###" >> ${logFile}
sudo sed -i "s/^message=.*/message='Setup System .'/g" ${infoFile}
# install litecoin (just if needed)
if [ "${network}" = "litecoin" ]; then
echo "Installing Litecoin ..." >> ${logFile}
/home/admin/config.scripts/blitz.litecoin.sh on >> ${logFile}
fi
# set hostname data
echo "Setting lightning alias: ${hostname}" >> ${logFile}
sudo sed -i "s/^alias=.*/alias=${hostname}/g" /home/admin/assets/lnd.${network}.conf >> ${logFile} 2>&1

View File

@ -0,0 +1,71 @@
# INFOFILE - state data from bootstrap
infoFile="/home/admin/raspiblitz.info"
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# installing and changing to litecoin as base blockchain"
echo "# IMPORTANT: JUST MAKE CHANGE DURING SETUP"
echo "# blitz.litecoin.sh [on]"
echo "error='missing parameters'"
exit 1
fi
isRaspbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Raspbian')
if [ ${isRaspbian} -eq 0]; then
echo "error='litecoin is only avaulable for raspbian realease'"
exit 1
else
echo ""
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.17.1"
litecoinSHA256="7e6f5a1f0b190de01aa20ecf5c5a2cc5a64eb7ede0806bcba983bcd803324d8a"
# cleaning download folder
sudo rm -r /home/admin/download 1>/dev/null
sudo -u admin mkdir -p /home/admin/download
cd /home/admin/download
# download
binaryName="litecoin-${litecoinVersion}-arm-linux-gnueabihf.tar.gz"
sudo -u admin wget https://download.litecoin.org/litecoin-${litecoinVersion}/linux/${binaryName} 1>/dev/null
# check download
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
if [ "${binaryChecksum}" != "${litecoinSHA256}" ]; then
echo "# !!! FAIL !!! Downloaded LITECOIN BINARY not matching SHA256 checksum: ${litecoinSHA256}"
echo "error='checksum failed'"
exit 1
fi
# install
sudo -u admin tar -xvf ${binaryName}
sudo install -m 0755 -o root -g root -t /usr/local/bin litecoin-${litecoinVersion}/bin/*
installed=$(sudo -u admin litecoind --version | grep "${litecoinVersion}" -c)
if [ ${installed} -lt 1 ]; then
echo ""
echo "# !!! BUILD FAILED --> Was not able to install litecoind version(${litecoinVersion})"
echo "error='install failed'"
exit 1
else
# set network info
sed -i "s/^network=.*/network=litecoin/g" ${infoFile}
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
###### OPTIMIZE IF RAM >1GB
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
if [ ${kbSizeRAM} -gt 1500000 ]; then
echo "Detected RAM >1GB --> optimizing ${network}.conf"
sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/litecoin.conf
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/litecoin.conf
fi
fi
fi

View File

@ -6,13 +6,13 @@
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# managing the RaspiBlitz data - import, export, backup."
echo "# blitz.rescue.sh [status|export|import]"
echo "ERROR='missing parameters'"
echo "error='missing parameters'"
exit 1
fi
# check if started with sudo
if [ "$EUID" -ne 0 ]; then
echo "ERROR='missing sudo'"
echo "error='missing sudo'"
exit 1
fi