#!/bin/bash # Turn on DHCP (IPv4 + IPv6) on the wired port and install the SSH server. set -e if [ "$(id -u)" != 0 ]; then echo "Run with sudo: curl -fsSL get.xeve.dev | sudo bash"; exit 1; fi IF=$(ip -o link show | awk -F': ' '$2 ~ /^(en|eth)/ {print $2; exit}') [ -n "$IF" ] || { echo "No wired network port found"; exit 1; } echo ">> Wired port: $IF" mkdir -p /root/netplan-backup cp -a /etc/netplan/*.yaml /root/netplan-backup/ 2>/dev/null || true rm -f /etc/netplan/*.yaml cat > /etc/netplan/01-dhcp.yaml <> Applying network config (old files saved in /root/netplan-backup)" netplan apply for i in $(seq 1 20); do ip -4 addr show "$IF" | grep -q 'inet ' && break sleep 1 done echo ">> Installing openssh-server" export DEBIAN_FRONTEND=noninteractive apt-get update -qq apt-get install -y -qq openssh-server systemctl enable --now ssh echo echo "================ RESULT ================" echo "Hostname : $(hostname)" echo "IPv4 : $(ip -4 -o addr show "$IF" | awk '{print $4}' | head -1)" echo "IPv6 : $(ip -6 -o addr show "$IF" scope global | awk '{print $4}' | head -1)" echo "SSH : $(systemctl is-active ssh)" echo "========================================" echo "Take a photo of this box and send it."