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 install_nodejs || log_error "Failed to install Node.js" 1
# Run install_lightning_pub and capture its exit code directly. # 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" install_lightning_pub "$REPO_URL"
pub_install_status=$? pub_install_status=$?

View file

@ -2,6 +2,11 @@
install_lightning_pub() { install_lightning_pub() {
local REPO_URL="$1" 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 local upgrade_status=0
if [ -z "$REPO_URL" ]; then if [ -z "$REPO_URL" ]; then
@ -36,8 +41,6 @@ install_lightning_pub() {
fi fi
LATEST_COMMIT=$(echo "$API_RESPONSE" | awk -F'[/"]' '/"html_url": ".*\/commit\// {print $(NF-1); exit}') LATEST_COMMIT=$(echo "$API_RESPONSE" | awk -F'[/"]' '/"html_url": ".*\/commit\// {print $(NF-1); exit}')
if [ -z "$LATEST_COMMIT" ]; then 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 log_error "Could not retrieve latest version from GitHub. Upgrade check failed. Aborting." 1
fi 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)." log "systemctl not available. Please start the services manually (e.g., run lnd and npm start in separate terminals)."
fi fi
elif [ "$OS" = "Mac" ]; then elif [ "$OS" = "Mac" ]; then
# NOTE: macOS support is untested and unsupported. Use at your own risk. # NOTE: macOS support is untested and unsupported. Use at your own risk. (restore)
log "macOS detected. Please configure launchd manually to start ${SECONDARY_COLOR}LND${RESET_COLOR} and ${SECONDARY_COLOR}Lightning.Pub${RESET_COLOR} at startup." log "macOS detected. Please configure launchd manually..."
elif [ "$OS" = "Cygwin" ] || [ "$OS" = "MinGw" ]; then 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." 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 else