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=$?
|
||||
|
||||
if [ $install_result -ne 0 ]; then
|
||||
printf "%s\n" "$lnd_output"
|
||||
log_error "LND installation failed" $install_result
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ TMP_LOG_FILE=$(mktemp)
|
|||
|
||||
log() {
|
||||
local message="$(date '+%Y-%m-%d %H:%M:%S') $1"
|
||||
echo -e "$message"
|
||||
# Write to the temporary log file.
|
||||
echo -e "$(echo "$message" | sed 's/\\e\[[0-9;]*m//g')" >> "$TMP_LOG_FILE"
|
||||
# Use printf for cross-platform compatibility (macOS echo -e issues)
|
||||
printf "%b\n" "$message"
|
||||
# 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"
|
||||
|
|
@ -35,7 +36,7 @@ download() {
|
|||
if command -v wget &> /dev/null; then
|
||||
wget -q "$url" -O "$dest"
|
||||
elif command -v curl &> /dev/null; then
|
||||
curl -sL "$url" -o "$dest"
|
||||
curl -fsL "$url" -o "$dest"
|
||||
else
|
||||
log_error "Neither wget nor curl found. Please install one." 1
|
||||
fi
|
||||
|
|
@ -112,9 +113,10 @@ else
|
|||
lnd_output=$(install_lnd)
|
||||
install_result=$?
|
||||
|
||||
if [ $install_result -ne 0 ]; then
|
||||
log_error "LND installation failed" $install_result
|
||||
fi
|
||||
if [ $install_result -ne 0 ]; then
|
||||
printf "%s\n" "$lnd_output"
|
||||
log_error "LND installation failed" $install_result
|
||||
fi
|
||||
|
||||
lnd_status=$(echo "$lnd_output" | grep "LND_STATUS:" | cut -d':' -f2)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ install_lnd() {
|
|||
log "Checking latest LND version..."
|
||||
local api_response=$(download_stdout "https://api.github.com/repos/lightningnetwork/lnd/releases/latest")
|
||||
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"
|
||||
|
||||
local LND_OS="$OS"; [ "$OS" = "Mac" ] && LND_OS="darwin"
|
||||
|
|
|
|||
|
|
@ -84,7 +84,10 @@ download() {
|
|||
if command -v wget &> /dev/null; then
|
||||
wget -q "$url" -O "$dest"
|
||||
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
|
||||
log "Error: Neither wget nor curl found."
|
||||
return 1
|
||||
|
|
@ -97,7 +100,7 @@ download_stdout() {
|
|||
if command -v wget &> /dev/null; then
|
||||
wget -qO- "$url"
|
||||
elif command -v curl &> /dev/null; then
|
||||
curl -sL "$url"
|
||||
curl -fsL "$url"
|
||||
else
|
||||
log "Error: Neither wget nor curl found."
|
||||
return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue