This commit is contained in:
Justin (shocknet) 2024-07-23 13:36:14 -04:00
parent 86bbe4f1dc
commit 351b3e16fa
5 changed files with 80 additions and 65 deletions

View file

@ -1,6 +1,13 @@
#!/bin/bash
set -e
# Function to log errors
log_error() {
log "ERROR: $1"
log "Exiting with status $2"
exit $2
}
BASE_URL="https://raw.githubusercontent.com/shocknet/Lightning.Pub/master/scripts/"
modules=(
@ -21,26 +28,37 @@ for module in "${modules[@]}"; do
source "/tmp/${module}.sh"
done
# Upgrade flag
SKIP_PROMPT=false
for arg in "$@"; do
case $arg in
--yes)
SKIP_PROMPT=true
shift
;;
esac
done
detect_os_arch
if [ "$OS" = "Mac" ]; then
handle_macos
else
install_lnd
LND_UPGRADE=$?
install_nodejs
PUB_UPGRADE_STATUS=$(install_lightning_pub)
start_services $LND_UPGRADE $PUB_UPGRADE_STATUS
install_lnd || log_error "LND installation failed" $?
lnd_upgrade_status=$?
install_nodejs || log_error "NodeJS installation failed" $?
pub_output=$(install_lightning_pub)
install_result=$?
if [ $install_result -ne 0 ]; then
log_error "Lightning.Pub installation failed" $install_result
fi
# Extract the upgrade status from the output
pub_upgrade_status=$(echo "$pub_output" | grep "UPGRADE_STATUS:" | cut -d':' -f2)
if [ "$pub_upgrade_status" = "100" ]; then
log "Lightning.Pub upgrade completed successfully."
elif [ "$pub_upgrade_status" = "0" ]; then
log "Lightning.Pub fresh installation completed successfully."
else
log "WARNING: Unexpected return status from install_lightning_pub: $pub_upgrade_status"
log "Full output: $pub_output"
fi
start_services $lnd_upgrade_status $pub_upgrade_status
get_log_info
log "Installation process completed successfully"
fi