mirror of
https://github.com/Retropex/raspiblitz.git
synced 2025-05-28 13:02:30 +02:00
CL install from source from github instead of zip (#2936)
This commit is contained in:
parent
dfe0b69c99
commit
c61bd1d53f
@ -50,8 +50,10 @@ _temp="$(mktemp -p /dev/shm/)"
|
|||||||
if [ $# -eq 3 ]; then
|
if [ $# -eq 3 ]; then
|
||||||
commitHash="$(git log --oneline | head -1 | awk '{print $1}')"
|
commitHash="$(git log --oneline | head -1 | awk '{print $1}')"
|
||||||
gitCommand="git verify-commit $commitHash"
|
gitCommand="git verify-commit $commitHash"
|
||||||
|
commitOrTag="$commitHash commit"
|
||||||
elif [ $# -eq 4 ]; then
|
elif [ $# -eq 4 ]; then
|
||||||
gitCommand="git verify-tag $4"
|
gitCommand="git verify-tag $4"
|
||||||
|
commitOrTag="$4 tag"
|
||||||
fi
|
fi
|
||||||
echo "# running: ${gitCommand}"
|
echo "# running: ${gitCommand}"
|
||||||
if ${gitCommand} 2>&1 >&"$_temp"; then
|
if ${gitCommand} 2>&1 >&"$_temp"; then
|
||||||
@ -60,7 +62,7 @@ else
|
|||||||
goodSignature=0
|
goodSignature=0
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
cat $_temp
|
cat "$_temp"
|
||||||
echo "# goodSignature(${goodSignature})"
|
echo "# goodSignature(${goodSignature})"
|
||||||
|
|
||||||
correctKey=$(tr -d " \t\n\r" < "$_temp" | grep "${PGPpubkeyFingerprint}" -c)
|
correctKey=$(tr -d " \t\n\r" < "$_temp" | grep "${PGPpubkeyFingerprint}" -c)
|
||||||
@ -73,7 +75,7 @@ if [ "${correctKey}" -lt 1 ] || [ "${goodSignature}" -lt 1 ]; then
|
|||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "##########################################################################"
|
echo "##########################################################################"
|
||||||
echo "# OK --> the PGP signature of the checked out $commitHash commit is correct"
|
echo "# OK --> the PGP signature of the checked out ${commitOrTag} is correct"
|
||||||
echo "##########################################################################"
|
echo "##########################################################################"
|
||||||
echo
|
echo
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -10,12 +10,12 @@ CLVERSION=v0.10.2
|
|||||||
|
|
||||||
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
|
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
|
||||||
# PGPsigner="rustyrussel"
|
# PGPsigner="rustyrussel"
|
||||||
# PGPpkeys="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt"
|
# PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt"
|
||||||
# PGPcheck="D9200E6CD1ADB8F1"
|
# PGPpubkeyFingerprint="D9200E6CD1ADB8F1"
|
||||||
|
|
||||||
PGPsigner="cdecker"
|
PGPsigner="cdecker"
|
||||||
PGPpkeys="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/cdecker.txt"
|
PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt"
|
||||||
PGPcheck="A26D6D9FE088ED58"
|
PGPpubkeyFingerprint="A26D6D9FE088ED58"
|
||||||
|
|
||||||
# help
|
# help
|
||||||
if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
|
if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
|
||||||
@ -60,68 +60,82 @@ if [ "$1" = "install" ]; then
|
|||||||
echo "# no configuration, no systemd service"
|
echo "# no configuration, no systemd service"
|
||||||
|
|
||||||
# check if the binary is already installed
|
# check if the binary is already installed
|
||||||
if [ $(sudo -u bitcoin lightning-cli --version 2>/dev/null | grep -c .) -gt 0 ]; then
|
if [ -f /usr/local/bin/lightningd ]; then
|
||||||
echo "c-lightning binary already installed - done"
|
echo "c-lightning binary already installed - done"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prepare download dir
|
## Install from zip
|
||||||
sudo rm -rf /home/bitcoin/download
|
# # prepare download dir
|
||||||
sudo -u bitcoin mkdir -p /home/bitcoin/download
|
# sudo rm -rf /home/bitcoin/download
|
||||||
cd /home/bitcoin/download || exit 1
|
# sudo -u bitcoin mkdir -p /home/bitcoin/download
|
||||||
|
# cd /home/bitcoin/download || exit 1
|
||||||
|
#
|
||||||
|
# sudo -u bitcoin wget -O "pgp_keys.asc" ${PGPpubkeyLink}
|
||||||
|
# sudo -u bitcoin gpg --import --import-options show-only ./pgp_keys.asc
|
||||||
|
# fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c)
|
||||||
|
# if [ ${fingerprint} -lt 1 ]; then
|
||||||
|
# echo
|
||||||
|
# echo "!!! WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}"
|
||||||
|
# echo "Should contain PGP: ${PGPpubkeyFingerprint}"
|
||||||
|
# echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
|
||||||
|
# read key
|
||||||
|
# fi
|
||||||
|
# sudo -u bitcoin gpg --import ./pgp_keys.asc
|
||||||
|
#
|
||||||
|
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS
|
||||||
|
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS.asc
|
||||||
|
#
|
||||||
|
# verifyResult=$(sudo -u bitcoin gpg --verify SHA256SUMS.asc 2>&1)
|
||||||
|
#
|
||||||
|
# goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
||||||
|
# echo "goodSignature(${goodSignature})"
|
||||||
|
# correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPpubkeyFingerprint}" -c)
|
||||||
|
# echo "correctKey(${correctKey})"
|
||||||
|
# if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
||||||
|
# echo
|
||||||
|
# echo "!!! DOWNLOAD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})"
|
||||||
|
# exit 1
|
||||||
|
# else
|
||||||
|
# echo
|
||||||
|
# echo "****************************************************************"
|
||||||
|
# echo "OK --> the PGP signature of the C-lightning SHA256SUMS is correct"
|
||||||
|
# echo "****************************************************************"
|
||||||
|
# echo
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/clightning-${CLVERSION}.zip
|
||||||
|
#
|
||||||
|
# hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1)
|
||||||
|
# goodHash=$(echo ${hashCheckResult} | grep 'OK' -c)
|
||||||
|
# echo "goodHash(${goodHash})"
|
||||||
|
# if [ ${goodHash} -lt 1 ]; then
|
||||||
|
# echo
|
||||||
|
# echo "!!! BUILD FAILED --> Hash check not OK"
|
||||||
|
# exit 1
|
||||||
|
# else
|
||||||
|
# echo
|
||||||
|
# echo "********************************************************************"
|
||||||
|
# echo "OK --> the hash of the downloaded C-lightning source code is correct"
|
||||||
|
# echo "********************************************************************"
|
||||||
|
# echo
|
||||||
|
# fi
|
||||||
|
#
|
||||||
|
# sudo -u bitcoin unzip clightning-${CLVERSION}.zip
|
||||||
|
# cd clightning-${CLVERSION} || exit 1
|
||||||
|
|
||||||
sudo -u bitcoin wget -O "pgp_keys.asc" ${PGPpkeys}
|
cd /home/bitcoin || exit 1
|
||||||
sudo -u bitcoin gpg --import --import-options show-only ./pgp_keys.asc
|
echo
|
||||||
fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPcheck}" -c)
|
echo "- Cloning https://github.com/ElementsProject/lightning.git"
|
||||||
if [ ${fingerprint} -lt 1 ]; then
|
echo
|
||||||
echo
|
sudo -u bitcoin git clone https://github.com/ElementsProject/lightning.git
|
||||||
echo "!!! WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}"
|
cd lightning || exit 1
|
||||||
echo "Should contain PGP: ${PGPcheck}"
|
echo
|
||||||
echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
|
echo "- Reset to version $CLVERSION"
|
||||||
read key
|
sudo -u bitcoin git reset --hard $CLVERSION
|
||||||
fi
|
|
||||||
sudo -u bitcoin gpg --import ./pgp_keys.asc
|
|
||||||
|
|
||||||
sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS
|
sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \
|
||||||
sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS.asc
|
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLVERSION}" || exit 1
|
||||||
|
|
||||||
verifyResult=$(sudo -u bitcoin gpg --verify SHA256SUMS.asc 2>&1)
|
|
||||||
|
|
||||||
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
|
||||||
echo "goodSignature(${goodSignature})"
|
|
||||||
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPcheck}" -c)
|
|
||||||
echo "correctKey(${correctKey})"
|
|
||||||
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
|
||||||
echo
|
|
||||||
echo "!!! DOWNLOAD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "****************************************************************"
|
|
||||||
echo "OK --> the PGP signature of the C-lightning SHA256SUMS is correct"
|
|
||||||
echo "****************************************************************"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/clightning-${CLVERSION}.zip
|
|
||||||
|
|
||||||
hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1)
|
|
||||||
goodHash=$(echo ${hashCheckResult} | grep 'OK' -c)
|
|
||||||
echo "goodHash(${goodHash})"
|
|
||||||
if [ ${goodHash} -lt 1 ]; then
|
|
||||||
echo
|
|
||||||
echo "!!! BUILD FAILED --> Hash check not OK"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "********************************************************************"
|
|
||||||
echo "OK --> the hash of the downloaded C-lightning source code is correct"
|
|
||||||
echo "********************************************************************"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo -u bitcoin unzip clightning-${CLVERSION}.zip
|
|
||||||
cd clightning-${CLVERSION} || exit 1
|
|
||||||
|
|
||||||
installDependencies
|
installDependencies
|
||||||
|
|
||||||
@ -142,7 +156,7 @@ if [ "$1" = "install" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
correctVersion=$(echo "${installed}" | grep -c "${CLVERSION:1}")
|
correctVersion=$(echo "${installed}" | grep -c "${CLVERSION:1}")
|
||||||
if [ ${correctVersion} -eq 0 ]; then
|
if [ "${correctVersion}" -eq 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "!!! BUILD FAILED --> installed C-lightning is not version ${CLVERSION}"
|
echo "!!! BUILD FAILED --> installed C-lightning is not version ${CLVERSION}"
|
||||||
sudo -u bitcoin lightning-cli --version
|
sudo -u bitcoin lightning-cli --version
|
||||||
|
Loading…
Reference in New Issue
Block a user