This commit is contained in:
shocknet-justin 2025-08-30 16:51:42 -04:00
parent 7eefd2ee92
commit 25fb4da988
3 changed files with 8 additions and 5 deletions

View file

@ -93,7 +93,7 @@ else
install_nodejs || log_error "Failed to install Node.js" 1
# Run install_lightning_pub and capture its exit code directly.
# We expect specific exit codes (0 for success, 2 for no update), so we handle them.
# Exit codes from install_lightning_pub: 0=fresh, 100=upgrade, 2=no-op
install_lightning_pub "$REPO_URL"
pub_install_status=$?

View file

@ -2,6 +2,11 @@
install_lightning_pub() {
local REPO_URL="$1"
# Defined exit codes for this function:
# 0: Fresh install success (triggers service start)
# 100: Upgrade success (triggers service restart)
# 2: No-op (already up-to-date, skip services)
# Other: Error
local upgrade_status=0
if [ -z "$REPO_URL" ]; then
@ -36,8 +41,6 @@ install_lightning_pub() {
fi
LATEST_COMMIT=$(echo "$API_RESPONSE" | awk -F'[/"]' '/"html_url": ".*\/commit\// {print $(NF-1); exit}')
if [ -z "$LATEST_COMMIT" ]; then
log "GitHub API response was not as expected. Full response for debugging:"
log "$API_RESPONSE"
log_error "Could not retrieve latest version from GitHub. Upgrade check failed. Aborting." 1
fi

View file

@ -91,8 +91,8 @@ start_services() {
log "systemctl not available. Please start the services manually (e.g., run lnd and npm start in separate terminals)."
fi
elif [ "$OS" = "Mac" ]; then
# NOTE: macOS support is untested and unsupported. Use at your own risk.
log "macOS detected. Please configure launchd manually to start ${SECONDARY_COLOR}LND${RESET_COLOR} and ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR} at startup."
# NOTE: macOS support is untested and unsupported. Use at your own risk. (restore)
log "macOS detected. Please configure launchd manually..."
elif [ "$OS" = "Cygwin" ] || [ "$OS" = "MinGw" ]; then
log "Windows detected. Please configure your startup scripts manually to start ${SECONDARY_COLOR}LND${RESET_COLOR} and ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR} at startup."
else