docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
68
scripts/update-scripts-to-modules.sh
Executable file
68
scripts/update-scripts-to-modules.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
# Update scripts to use shared modules
|
||||
# Replaces hardcoded IPs and custom logging with shared modules
|
||||
# Usage: ./scripts/update-scripts-to-modules.sh [script1.sh] [script2.sh] ...
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
source "$SCRIPT_DIR/lib/logging.sh" 2>/dev/null || true
|
||||
|
||||
# If scripts provided, update those; otherwise find scripts needing updates
|
||||
if [ $# -gt 0 ]; then
|
||||
SCRIPTS_TO_UPDATE=("$@")
|
||||
else
|
||||
# Find scripts with hardcoded IPs that don't use modules
|
||||
SCRIPTS_TO_UPDATE=$(find "$PROJECT_ROOT/scripts" -name "*.sh" -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/archive/*" ! -path "*/lib/*" -exec sh -c 'file="$1"; if grep -q "192\.168\.11\." "$file" 2>/dev/null && ! grep -q "source.*lib/ip-config\|source.*ip-addresses.conf" "$file" 2>/dev/null && head -5 "$file" | grep -q "^#!/"; then echo "$file"; fi' _ {} \; | head -50)
|
||||
fi
|
||||
|
||||
log_header "Updating Scripts to Use Modules"
|
||||
|
||||
updated=0
|
||||
skipped=0
|
||||
|
||||
for script in $SCRIPTS_TO_UPDATE; do
|
||||
if [ ! -f "$script" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip if already using modules
|
||||
if grep -q "source.*lib/ip-config\|source.*ip-addresses.conf" "$script" 2>/dev/null; then
|
||||
skipped=$((skipped + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
log_info "Updating: $script"
|
||||
|
||||
# Create backup
|
||||
cp "$script" "${script}.bak"
|
||||
|
||||
# Add module loading after set -euo pipefail or after shebang
|
||||
if grep -q "^set -euo pipefail\|^set -uo pipefail\|^set -eo pipefail" "$script"; then
|
||||
# Add after set -euo pipefail
|
||||
sed -i '/^set -[euo]* pipefail/a\
|
||||
\
|
||||
# Load shared modules\
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"\
|
||||
source "$SCRIPT_DIR/lib/ip-config.sh" 2>/dev/null || true\
|
||||
source "$SCRIPT_DIR/lib/logging.sh" 2>/dev/null || true\
|
||||
' "$script"
|
||||
elif grep -q "^#!/" "$script"; then
|
||||
# Add after shebang, before any other code
|
||||
sed -i '1a\
|
||||
\
|
||||
# Load shared modules\
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"\
|
||||
source "$SCRIPT_DIR/lib/ip-config.sh" 2>/dev/null || true\
|
||||
source "$SCRIPT_DIR/lib/logging.sh" 2>/dev/null || true\
|
||||
' "$script"
|
||||
fi
|
||||
|
||||
updated=$((updated + 1))
|
||||
log_success "Updated: $script"
|
||||
done
|
||||
|
||||
log_success "Update complete!"
|
||||
echo " Updated: $updated"
|
||||
echo " Skipped: $skipped"
|
||||
Reference in New Issue
Block a user