mac debug
This commit is contained in:
parent
ba1984c106
commit
f138b71406
4 changed files with 20 additions and 9 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -112,9 +113,10 @@ else
|
||||||
lnd_output=$(install_lnd)
|
lnd_output=$(install_lnd)
|
||||||
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
|
||||||
|
|
||||||
lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2)
|
lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue