mac debug

This commit is contained in:
shocknet-justin 2025-11-26 12:48:13 -05:00
parent ba1984c106
commit f138b71406
4 changed files with 20 additions and 9 deletions

View file

@ -21,6 +21,7 @@ handle_macos() {
install_result=$? install_result=$?
if [ $install_result -ne 0 ]; then if [ $install_result -ne 0 ]; then
printf "%s\n" "$lnd_output"
log_error "LND installation failed" $install_result log_error "LND installation failed" $install_result
fi fi

View file

@ -6,9 +6,10 @@ TMP_LOG_FILE=$(mktemp)
log() { log() {
local message="$(date '+%Y-%m-%d %H:%M:%S') $1" local message="$(date '+%Y-%m-%d %H:%M:%S') $1"
echo -e "$message" # Use printf for cross-platform compatibility (macOS echo -e issues)
# Write to the temporary log file. printf "%b\n" "$message"
echo -e "$(echo "$message" | sed 's/\\e\[[0-9;]*m//g')" >> "$TMP_LOG_FILE" # Write to the temporary log file (strip colors)
echo "$message" | sed 's/\\e\[[0-9;]*m//g' >> "$TMP_LOG_FILE"
} }
SCRIPT_VERSION="0.3.0" SCRIPT_VERSION="0.3.0"
@ -35,7 +36,7 @@ download() {
if command -v wget &> /dev/null; then if command -v wget &> /dev/null; then
wget -q "$url" -O "$dest" wget -q "$url" -O "$dest"
elif command -v curl &> /dev/null; then elif command -v curl &> /dev/null; then
curl -sL "$url" -o "$dest" curl -fsL "$url" -o "$dest"
else else
log_error "Neither wget nor curl found. Please install one." 1 log_error "Neither wget nor curl found. Please install one." 1
fi fi
@ -113,6 +114,7 @@ else
install_result=$? install_result=$?
if [ $install_result -ne 0 ]; then if [ $install_result -ne 0 ]; then
printf "%s\n" "$lnd_output"
log_error "LND installation failed" $install_result log_error "LND installation failed" $install_result
fi fi

View file

@ -11,6 +11,11 @@ install_lnd() {
log "Checking latest LND version..." log "Checking latest LND version..."
local api_response=$(download_stdout "https://api.github.com/repos/lightningnetwork/lnd/releases/latest") local api_response=$(download_stdout "https://api.github.com/repos/lightningnetwork/lnd/releases/latest")
LND_VERSION=$(json_value "tag_name" "$api_response") LND_VERSION=$(json_value "tag_name" "$api_response")
if [ -z "$LND_VERSION" ]; then
log "${PRIMARY_COLOR}Failed to fetch latest LND version.${RESET_COLOR}"
exit 1
fi
log "Latest LND version: $LND_VERSION" log "Latest LND version: $LND_VERSION"
local LND_OS="$OS"; [ "$OS" = "Mac" ] && LND_OS="darwin" local LND_OS="$OS"; [ "$OS" = "Mac" ] && LND_OS="darwin"

View file

@ -84,7 +84,10 @@ download() {
if command -v wget &> /dev/null; then if command -v wget &> /dev/null; then
wget -q "$url" -O "$dest" wget -q "$url" -O "$dest"
elif command -v curl &> /dev/null; then elif command -v curl &> /dev/null; then
curl -sL "$url" -o "$dest" # -f: fail on HTTP errors (404/500)
# -s: silent
# -L: follow redirects
curl -fsL "$url" -o "$dest"
else else
log "Error: Neither wget nor curl found." log "Error: Neither wget nor curl found."
return 1 return 1
@ -97,7 +100,7 @@ download_stdout() {
if command -v wget &> /dev/null; then if command -v wget &> /dev/null; then
wget -qO- "$url" wget -qO- "$url"
elif command -v curl &> /dev/null; then elif command -v curl &> /dev/null; then
curl -sL "$url" curl -fsL "$url"
else else
log "Error: Neither wget nor curl found." log "Error: Neither wget nor curl found."
return 1 return 1