clean update and testPR options #2937

This commit is contained in:
openoms
2022-02-07 14:49:46 +00:00
parent c61bd1d53f
commit a6655ef1cb

View File

@@ -53,6 +53,20 @@ function installDependencies()
sudo -u bitcoin pip3 install --user -r requirements.txt sudo -u bitcoin pip3 install --user -r requirements.txt
} }
function buildAndInstallCLbinaries()
{
echo "- Configuring EXPERIMENTAL_FEATURES enabled"
echo
sudo -u bitcoin ./configure --enable-experimental-features
echo
echo "- Building C-lightning from source"
echo
sudo -u bitcoin make
echo
echo "- Install to /usr/local/bin/"
sudo make install || exit 1
}
if [ "$1" = "install" ]; then if [ "$1" = "install" ]; then
echo "# *** INSTALL C-LIGHTNING ${CLVERSION} BINARY ***" echo "# *** INSTALL C-LIGHTNING ${CLVERSION} BINARY ***"
@@ -65,7 +79,7 @@ if [ "$1" = "install" ]; then
exit 1 exit 1
fi fi
## Install from zip ## Download and verify zip
# # prepare download dir # # prepare download dir
# sudo rm -rf /home/bitcoin/download # sudo rm -rf /home/bitcoin/download
# sudo -u bitcoin mkdir -p /home/bitcoin/download # sudo -u bitcoin mkdir -p /home/bitcoin/download
@@ -124,6 +138,7 @@ if [ "$1" = "install" ]; then
# sudo -u bitcoin unzip clightning-${CLVERSION}.zip # sudo -u bitcoin unzip clightning-${CLVERSION}.zip
# cd clightning-${CLVERSION} || exit 1 # cd clightning-${CLVERSION} || exit 1
# download and verify the source from github
cd /home/bitcoin || exit 1 cd /home/bitcoin || exit 1
echo echo
echo "- Cloning https://github.com/ElementsProject/lightning.git" echo "- Cloning https://github.com/ElementsProject/lightning.git"
@@ -139,14 +154,7 @@ if [ "$1" = "install" ]; then
installDependencies installDependencies
echo "- Configuring EXPERIMENTAL_FEATURES enabled" buildAndInstallCLbinaries
sudo -u bitcoin ./configure --enable-experimental-features
echo "- Building C-lightning from source"
sudo -u bitcoin make
echo "- Install to /usr/local/bin/"
sudo make install || exit 1
installed=$(sudo -u bitcoin lightning-cli --version) installed=$(sudo -u bitcoin lightning-cli --version)
if [ ${#installed} -eq 0 ]; then if [ ${#installed} -eq 0 ]; then
@@ -195,24 +203,14 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
exit 1 exit 1
fi fi
# make sure binary is installed (will skip if already done) if [ "$1" = "update" ]||[ "$1" = "testPR" ];then
/home/admin/config.scripts/cl.install.sh install
if [ ! -f /usr/local/bin/lightningd ]||[ "$1" = "update" ]||[ "$1" = "testPR" ];then
########################
# Install dependencies #
########################
echo "# apt update" echo "# apt update"
echo echo
sudo apt-get update sudo apt-get update
####################################
# Download and compile from source #
####################################
cd /home/bitcoin || exit 1 cd /home/bitcoin || exit 1
if [ "$1" = "update" ]||[ "$1" = "testPR" ]||[ "$1" = "experimental" ];then if [ "$1" = "update" ]||[ "$1" = "testPR" ];then
echo echo
echo "# Deleting the old source code" echo "# Deleting the old source code"
sudo rm -rf lightning sudo rm -rf lightning
@@ -243,41 +241,24 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
echo "# https://github.com/ElementsProject/lightning/pull/$PRnumber" echo "# https://github.com/ElementsProject/lightning/pull/$PRnumber"
sudo -u bitcoin git fetch origin pull/$PRnumber/head:pr$PRnumber || exit 1 sudo -u bitcoin git fetch origin pull/$PRnumber/head:pr$PRnumber || exit 1
sudo -u bitcoin git checkout pr$PRnumber || exit 1 sudo -u bitcoin git checkout pr$PRnumber || exit 1
else
echo "# Installing the version $CLVERSION"
sudo -u bitcoin git reset --hard $CLVERSION
fi fi
installDependencies installDependencies
echo "# Building with EXPERIMENTAL_FEATURES enabled"
echo
sudo -u bitcoin ./configure --enable-experimental-features
echo
currentCLversion=$(cd /home/bitcoin/lightning 2>/dev/null; \ currentCLversion=$(cd /home/bitcoin/lightning 2>/dev/null; \
git describe --tags 2>/dev/null) git describe --tags 2>/dev/null)
echo "# Building from source C-lightning $currentCLversion" echo "# Building from source C-lightning $currentCLversion"
echo
sudo -u bitcoin make buildAndInstallCLbinaries
echo
echo "# Built C-lightning $currentCLversion"
echo
echo "# Install to /usr/local/bin/"
echo
sudo make install || exit 1
# clean up
# cd .. && rm -rf lightning
else
installedVersion=$(sudo -u bitcoin /usr/local/bin/lightningd --version)
echo "# C-lightning ${installedVersion} is already installed"
fi fi
########## ##########
# Config # # Config #
########## ##########
# make sure binary is installed (will skip if already done)
/home/admin/config.scripts/cl.install.sh install
echo "# Make sure bitcoin is in the ${TORGROUP} group" echo "# Make sure bitcoin is in the ${TORGROUP} group"
sudo usermod -a -G ${TORGROUP} bitcoin sudo usermod -a -G ${TORGROUP} bitcoin