arch logs, fix

This commit is contained in:
Justin (shocknet) 2024-08-07 16:10:57 -04:00
parent 421873a7de
commit a15de6d55a
2 changed files with 15 additions and 11 deletions

View file

@ -29,18 +29,19 @@ get_log_info() {
exit 1 exit 1
fi fi
# Get the initial line count # Get the initial file size instead of line count
initial_lines=$(wc -l < "$latest_unlocker_log") initial_size=$(stat -c %s "$latest_unlocker_log")
# Wait for new wallet status in log file # Wait for new wallet status in log file
while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do while [ $(($(date +%s) - START_TIME)) -lt $MAX_WAIT_TIME ]; do
current_lines=$(wc -l < "$latest_unlocker_log") current_size=$(stat -c %s "$latest_unlocker_log")
if [ $current_lines -gt $initial_lines ]; then if [ $current_size -gt $initial_size ]; 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) 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 if [ -n "$latest_entry" ]; then
break break
fi fi
fi fi
initial_size=$current_size
sleep $WAIT_INTERVAL sleep $WAIT_INTERVAL
done done
@ -79,7 +80,7 @@ get_log_info() {
fi fi
elif [ -f "$DATA_DIR/app.nprofile" ]; then elif [ -f "$DATA_DIR/app.nprofile" ]; then
app_nprofile=$(cat "$DATA_DIR/app.nprofile") 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}" log "${SECONDARY_COLOR}$app_nprofile${RESET_COLOR}"
break break
fi fi

View file

@ -23,14 +23,17 @@ modules=(
) )
for module in "${modules[@]}"; do for module in "${modules[@]}"; do
wget -q "${BASE_URL}/${module}.sh" -O "/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" source "/tmp/${module}.sh" || log_error "Failed to source ${module}.sh" 1
done done
detect_os_arch detect_os_arch
log "Detected OS: $OS"
log "Detected ARCH: $ARCH"
if [ "$OS" = "Mac" ]; then if [ "$OS" = "Mac" ]; then
handle_macos log "Handling macOS specific setup"
handle_macos || log_error "macOS setup failed" 1
else else
lnd_output=$(install_lnd) lnd_output=$(install_lnd)
install_result=$? install_result=$?
@ -71,8 +74,8 @@ else
fi fi
log "Starting services..." log "Starting services..."
start_services $lnd_status $pub_upgrade_status start_services $lnd_status $pub_upgrade_status || log_error "Failed to start services" 1
get_log_info get_log_info || log_error "Failed to get log info" 1
log "Installation process completed successfully" log "Installation process completed successfully"
fi fi