From a15de6d55a511f4d10129ac2eac94197c1d4d029 Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" Date: Wed, 7 Aug 2024 16:10:57 -0400 Subject: [PATCH] arch logs, fix --- scripts/extract_nprofile.sh | 13 +++++++------ scripts/install.sh | 13 ++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/extract_nprofile.sh b/scripts/extract_nprofile.sh index 7cb20a18..d71a063b 100644 --- a/scripts/extract_nprofile.sh +++ b/scripts/extract_nprofile.sh @@ -29,18 +29,19 @@ get_log_info() { exit 1 fi - # Get the initial line count - initial_lines=$(wc -l < "$latest_unlocker_log") + # Get the initial file size instead of line count + initial_size=$(stat -c %s "$latest_unlocker_log") # Wait for new wallet status in log file while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do - current_lines=$(wc -l < "$latest_unlocker_log") - if [ $current_lines -gt $initial_lines ]; then - latest_entry=$(tail -n $((current_lines - initial_lines)) "$latest_unlocker_log" | grep -E "unlocker >> (the wallet is already unlocked|created wallet with pub|unlocked wallet with pub)" | tail -n 1) + current_size=$(stat -c %s "$latest_unlocker_log") + if [ $current_size -gt $initial_size ]; then + latest_entry=$(tail -c +$((initial_size + 1)) "$latest_unlocker_log" | grep -E "unlocker >> (the wallet is already unlocked|created wallet with pub|unlocked wallet with pub)" | tail -n 1) if [ -n "$latest_entry" ]; then break fi fi + initial_size=$current_size sleep $WAIT_INTERVAL done @@ -79,7 +80,7 @@ get_log_info() { fi elif [ -f "$DATA_DIR/app.nprofile" ]; then app_nprofile=$(cat "$DATA_DIR/app.nprofile") - log "Node is already set up. Use this nprofile to invite guestusers:" + log "Node is already set up. Use this nprofile to invite guest users:" log "${SECONDARY_COLOR}$app_nprofile${RESET_COLOR}" break fi diff --git a/scripts/install.sh b/scripts/install.sh index 6d838dc9..79ee7929 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -23,14 +23,17 @@ modules=( ) for module in "${modules[@]}"; do - wget -q "${BASE_URL}/${module}.sh" -O "/tmp/${module}.sh" - source "/tmp/${module}.sh" + wget -q "${BASE_URL}/${module}.sh" -O "/tmp/${module}.sh" || log_error "Failed to download ${module}.sh" 1 + source "/tmp/${module}.sh" || log_error "Failed to source ${module}.sh" 1 done detect_os_arch +log "Detected OS: $OS" +log "Detected ARCH: $ARCH" if [ "$OS" = "Mac" ]; then - handle_macos + log "Handling macOS specific setup" + handle_macos || log_error "macOS setup failed" 1 else lnd_output=$(install_lnd) install_result=$? @@ -71,8 +74,8 @@ else fi log "Starting services..." - start_services $lnd_status $pub_upgrade_status - get_log_info + start_services $lnd_status $pub_upgrade_status || log_error "Failed to start services" 1 + get_log_info || log_error "Failed to get log info" 1 log "Installation process completed successfully" fi \ No newline at end of file