Add Core Lighting for FreeBSD in prod installer

This commit is contained in:
Stephan Oeste 2022-08-05 16:41:00 +02:00
parent 63a22082bc
commit cacd4abd9d
No known key found for this signature in database
GPG key ID: 3152347D07DA627C

View file

@ -34,10 +34,11 @@ esac
TOR_INSTALL=ON
CERTBOT_INSTALL=ON
# install 3 network daemons
# install 4 network daemons
BITCOIN_INSTALL=ON
BISQ_INSTALL=ON
ELEMENTS_INSTALL=ON
CLN_INSTALL=ON
# configure 4 network instances
BITCOIN_MAINNET_ENABLE=ON
@ -187,6 +188,7 @@ case $OS in
NGINX_ETC_FOLDER=/usr/local/etc/nginx
NGINX_CONFIGURATION=/usr/local/etc/nginx/nginx.conf
CERTBOT_PKG=py39-certbot
CLN_PKG=c-lightning
;;
Debian)
@ -272,6 +274,12 @@ ELECTRS_LIQUID_DATA=${ELECTRS_DATA_ROOT}/liquid
ELECTRS_LIQUIDTESTNET_ZPOOL=${ZPOOL}
ELECTRS_LIQUIDTESTNET_DATA=${ELECTRS_DATA_ROOT}/liquidtestnet
# Core Lightning user/group
CLN_USER=cln
CLN_GROUP=cln
# Core Lightning home folder
CLN_HOME=/cln
# bisq user/group
BISQ_USER=bisq
BISQ_GROUP=bisq
@ -572,6 +580,10 @@ zfsCreateFilesystems()
done
fi
if [ "${CLN_INSTALL}" = ON ];then
zfs create -o "mountpoint=${CLN_HOME}" "${ZPOOL}/cln"
fi
if [ "${BISQ_INSTALL}" = ON ];then
zfs create -o "mountpoint=${BISQ_HOME}" "${ZPOOL}/bisq"
fi
@ -651,6 +663,10 @@ ext4CreateDir()
done
fi
if [ "${CLN_INSTALL}" = ON ];then
mkdir -p "${CLN_HOME}"
fi
if [ "${BISQ_INSTALL}" = ON ];then
mkdir -p "${BISQ_HOME}"
fi
@ -711,6 +727,7 @@ Testnet:Enable Bitcoin Testnet:ON
Signet:Enable Bitcoin Signet:ON
Liquid:Enable Elements Liquid:ON
Liquidtestnet:Enable Elements Liquidtestnet:ON
CoreLN:Enable Core Lightning:ON
Bisq:Enable Bisq:ON
EOF
@ -785,6 +802,12 @@ else
ELEMENTS_INSTALL=OFF
fi
if grep CoreLN $tempfile >/dev/null 2>&1;then
CLN_INSTALL=ON
else
CLN_INSTALL=OFF
fi
if grep Bisq $tempfile >/dev/null 2>&1;then
BISQ_INSTALL=ON
BISQ_MAINNET_ENABLE=ON
@ -1165,6 +1188,33 @@ if [ "${ELEMENTS_INSTALL}" = ON ;then
osSudo "${ELEMENTS_USER}" sh -c "cd ${ELEMENTS_ELECTRS_HOME} && cargo run --release --features liquid --bin electrs -- --network liquid --version" || true
fi
#####################################
# Core Lightning for Bitcoin Mainnet #
#####################################
echo "[*] Installing Core Lightning"
case $OS in
FreeBSD)
echo "[*] Creating Core Lightning user"
osGroupCreate "${CLN_GROUP}"
osUserCreate "${CLN_USER}" "${CLN_HOME}" "${CLN_GROUP}"
osSudo "${ROOT_USER}" chsh -s `which zsh` "${CLN_USER}"
osSudo "${ROOT_USER}" chown -R "${CLN_USER}:${CLN_GROUP}" "${CLN_HOME}"
osSudo "${CLN_USER}" touch "${CLN_HOME}/.zshrc"
echo "[*] Installing Core Lightning package"
osPackageInstall ${CLN_PKG}
echo "[*] Installing Core Lightning mainnet Cronjob"
crontab_cln+='@reboot sleep 30 ; screen -dmS main lightningd --alias `hostname` --bitcoin-datadir /bitcoin\n'
crontab_cln+='@reboot sleep 60 ; screen -dmS sig lightningd --alias `hostname` --bitcoin-datadir /bitcoin --network signet\n'
crontab_cln+='@reboot sleep 90 ; screen -dmS tes lightningd --alias `hostname` --bitcoin-datadir /bitcoin --network testnet\n'
echo "${crontab_cln}" | crontab -u "${CLN_USER}" -
;;
Debian)
;;
esac
#####################
# Bisq installation #
#####################