From 8105ef9471fe853312d51712f20f63e0868675ed Mon Sep 17 00:00:00 2001 From: "Justin (shocknet)" Date: Sat, 13 Jul 2024 16:42:44 -0400 Subject: [PATCH] deploy --- scripts/extract_nprofile.sh | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/scripts/extract_nprofile.sh b/scripts/extract_nprofile.sh index c25790947..9fdddffdc 100644 --- a/scripts/extract_nprofile.sh +++ b/scripts/extract_nprofile.sh @@ -17,19 +17,17 @@ get_log_info() { ls -1t ${LOG_DIR}/components/nostrMiddleware_*.log 2>/dev/null | head -n 1 } - # Echo "Waiting for build..." every 10 seconds until the unlocker log is available, with a 3-minute timeout TIMEOUT=180 while [ ! -f ${LOG_DIR}/components/unlocker_*.log ] && [ $TIMEOUT -gt 0 ]; do - echo "Waiting for build..." + log "${PRIMARY_COLOR}Waiting for build...${RESET_COLOR}" sleep 10 TIMEOUT=$((TIMEOUT - 10)) done if [ $TIMEOUT -le 0 ]; then - echo "Timeout waiting for unlocker log file." + log "${PRIMARY_COLOR}Timeout waiting for unlocker log file.${RESET_COLOR}" exit 1 fi - # Wait for wallet status messages with a 45s timeout TIMEOUT=45 while [ $TIMEOUT -gt 0 ]; do if grep -q -e "unlocker >> macaroon not found, creating wallet..." -e "unlocker >> the wallet is already unlocked" -e "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then @@ -39,43 +37,40 @@ get_log_info() { TIMEOUT=$((TIMEOUT - 1)) done if [ $TIMEOUT -le 0 ]; then - echo "Timeout waiting for wallet status message." + log "${PRIMARY_COLOR}Timeout waiting for wallet status message.${RESET_COLOR}" exit 1 fi if grep -q "unlocker >> macaroon not found, creating wallet..." ${LOG_DIR}/components/unlocker_*.log; then - echo "Creating wallet..." + log "${PRIMARY_COLOR}Creating wallet...${RESET_COLOR}" elif grep -q "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then - echo "Unlocking wallet..." + log "${PRIMARY_COLOR}Unlocking wallet...${RESET_COLOR}" else - echo "Wallet is already unlocked." + log "${PRIMARY_COLOR}Wallet is already unlocked.${RESET_COLOR}" fi - echo "Proceeding to nprofile attempts..." - while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do LATEST_LOG=$(find_latest_log) if [ -n "$LATEST_LOG" ]; then - echo "Found latest log: $LATEST_LOG" + log "${PRIMARY_COLOR}Got it!${RESET_COLOR}" break fi - echo "Awaiting nostr information..." + log "${PRIMARY_COLOR}Awaiting nostr information...${RESET_COLOR}" sleep 4 ATTEMPT=$((ATTEMPT + 1)) done if [ -z "$LATEST_LOG" ]; then - echo "Failed to find the log file, check service status" + log "${PRIMARY_COLOR}Failed to find the log file, check service status${RESET_COLOR}" exit 1 fi nprofile_key=$(grep -oP 'nprofile: \K\w+' "$LATEST_LOG") if [ -z "$nprofile_key" ]; then - echo "No nprofile key found in the log." + log "${PRIMARY_COLOR}No nprofile key found in the log.${RESET_COLOR}" exit 1 fi - # Print the extracted key - echo "Paste this string into ShockWallet to connect to the node: $nprofile_key" + log "${PRIMARY_COLOR}Paste this string into ShockWallet to connect to the node: ${SECONDARY_COLOR}$nprofile_key${RESET_COLOR}" } \ No newline at end of file