diff --git a/scripts/handle_macos.sh b/scripts/handle_macos.sh index 9c32f7ab..8fecd185 100644 --- a/scripts/handle_macos.sh +++ b/scripts/handle_macos.sh @@ -17,15 +17,17 @@ handle_macos() { # Install LND log "${PRIMARY_COLOR}Installing${RESET_COLOR} ${SECONDARY_COLOR}LND${RESET_COLOR}..." - lnd_output=$(install_lnd) + LND_STATUS_FILE=$(mktemp) + install_lnd "$LND_STATUS_FILE" install_result=$? if [ $install_result -ne 0 ]; then - printf "%s\n" "$lnd_output" + rm -f "$LND_STATUS_FILE" log_error "LND installation failed" $install_result fi - lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2) + lnd_status=$(cat "$LND_STATUS_FILE") + rm -f "$LND_STATUS_FILE" case $lnd_status in 0) log "LND fresh installation completed successfully." ;; diff --git a/scripts/install.sh b/scripts/install.sh index 87d9842f..e2121917 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -110,15 +110,17 @@ if [ "$OS" = "Mac" ]; then else # Explicit kickoff log for LND so the flow is clear in the install log log "${PRIMARY_COLOR}Installing${RESET_COLOR} ${SECONDARY_COLOR}LND${RESET_COLOR}..." - lnd_output=$(install_lnd) + LND_STATUS_FILE=$(mktemp) + install_lnd "$LND_STATUS_FILE" install_result=$? -if [ $install_result -ne 0 ]; then - printf "%s\n" "$lnd_output" - log_error "LND installation failed" $install_result -fi + if [ $install_result -ne 0 ]; then + rm -f "$LND_STATUS_FILE" + log_error "LND installation failed" $install_result + fi - lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2) + lnd_status=$(cat "$LND_STATUS_FILE") + rm -f "$LND_STATUS_FILE" case $lnd_status in 0) log "LND fresh installation completed successfully." ;; diff --git a/scripts/install_lnd.sh b/scripts/install_lnd.sh index ba1cb7d6..be2fdd14 100755 --- a/scripts/install_lnd.sh +++ b/scripts/install_lnd.sh @@ -1,6 +1,7 @@ #!/bin/bash install_lnd() { + local status_file="$1" local lnd_status=0 log "Starting LND installation/check process..." @@ -134,7 +135,10 @@ install_lnd() { fi log "LND installation/check process complete. Status: $lnd_status" - # Echo the LND status - echo "LND_STATUS:$lnd_status" + + if [ -n "$status_file" ]; then + echo "$lnd_status" > "$status_file" + fi + return 0 # Always return 0 to indicate success } \ No newline at end of file