#!/bin/sh # First boot network and service setup for Archipelago # Configure hostname if [ ! -f /etc/hostname.configured ]; then echo "archipelago-node" > /etc/hostname hostname archipelago-node touch /etc/hostname.configured fi # Configure networking - Ethernet with DHCP if [ ! -f /etc/network/interfaces.configured ]; then cat > /etc/network/interfaces <<'NETEOF' auto lo iface lo inet loopback # Automatic Ethernet configuration (DHCP) auto eth0 iface eth0 inet dhcp hostname archipelago-node # Fallback for other ethernet names auto enp0s3 iface enp0s3 inet dhcp hostname archipelago-node auto enp0s25 iface enp0s25 inet dhcp hostname archipelago-node auto ens0 iface ens0 inet dhcp hostname archipelago-node NETEOF touch /etc/network/interfaces.configured fi # Enable and start networking rc-update add networking boot 2>/dev/null || true rc-service networking start 2>/dev/null || true # Wait for network to be ready echo "Waiting for network..." retries=30 while [ $retries -gt 0 ]; do if ip route | grep -q default; then echo "✓ Network is ready" ip addr show | grep "inet " | grep -v "127.0.0.1" break fi retries=$((retries - 1)) sleep 1 done # Enable DNS if [ ! -f /etc/resolv.conf.configured ]; then cat > /etc/resolv.conf <<'DNSEOF' nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 1.1.1.1 DNSEOF touch /etc/resolv.conf.configured fi # Test internet connectivity echo "Testing internet connectivity..." if ping -c 2 8.8.8.8 >/dev/null 2>&1; then echo "✓ Internet connection established" else echo "⚠ Warning: No internet connection detected" fi # Enable Archipelago service rc-update add archipelago default 2>/dev/null || true # Display access information echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "🏝️ Archipelago Bitcoin Node OS" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" echo "Network Configuration:" ip -4 addr show | grep inet | grep -v 127.0.0.1 | awk '{print " IP Address: " $2}' echo "" echo "Access the Archipelago UI at:" ip -4 addr show | grep inet | grep -v 127.0.0.1 | awk '{print " http://" $2}' | sed 's|/.*|:8100|' echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"