From c9f5224c42c424b3a202f03a2918f33babcc5cb0 Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Fri, 27 Mar 2026 21:07:14 +0300 Subject: [PATCH] feat(console): add netconf command for quick network setup Interactive script: lists interfaces, DHCP or static IP config. Shown as hint in tty1 welcome message. Co-Authored-By: Claude Sonnet 4.6 --- iso/overlay/etc/profile.d/bee.sh | 4 +-- iso/overlay/usr/local/bin/netconf | 50 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100755 iso/overlay/usr/local/bin/netconf diff --git a/iso/overlay/etc/profile.d/bee.sh b/iso/overlay/etc/profile.d/bee.sh index d11830c..e9519be 100644 --- a/iso/overlay/etc/profile.d/bee.sh +++ b/iso/overlay/etc/profile.d/bee.sh @@ -13,6 +13,6 @@ if [ -z "${SSH_CONNECTION:-}" ] \ done unset _ips _ip echo "" - echo " Local desktop starts automatically on display :0" - echo " Kernel logs: Alt+F2 | Extra shell: Alt+F3" + echo " Network setup: netconf" + echo " Kernel logs: Alt+F2 | Extra shell: Alt+F3" fi diff --git a/iso/overlay/usr/local/bin/netconf b/iso/overlay/usr/local/bin/netconf new file mode 100755 index 0000000..63d2aff --- /dev/null +++ b/iso/overlay/usr/local/bin/netconf @@ -0,0 +1,50 @@ +#!/bin/sh +# Quick network configurator for the local console. +set -e + +# List interfaces (exclude lo) +IFACES=$(ip -o link show | awk -F': ' '$2 != "lo" {print $2}' | cut -d@ -f1) + +echo "Interfaces:" +i=1 +for iface in $IFACES; do + ip=$(ip -4 addr show "$iface" 2>/dev/null | awk '/inet /{print $2}' | head -1) + echo " $i) $iface ${ip:-no IP}" + i=$((i+1)) +done +echo "" +printf "Interface name [or Enter to pick first]: " +read IFACE +if [ -z "$IFACE" ]; then + IFACE=$(echo "$IFACES" | head -1) +fi +echo "Selected: $IFACE" +echo "" +echo " 1) DHCP" +echo " 2) Static" +printf "Mode [1]: " +read MODE +MODE=${MODE:-1} + +if [ "$MODE" = "1" ]; then + echo "Running DHCP on $IFACE..." + dhclient -v "$IFACE" +else + printf "IP address (e.g. 192.168.1.100/24): " + read ADDR + printf "Gateway (e.g. 192.168.1.1): " + read GW + printf "DNS [8.8.8.8]: " + read DNS + DNS=${DNS:-8.8.8.8} + + ip addr flush dev "$IFACE" + ip addr add "$ADDR" dev "$IFACE" + ip link set "$IFACE" up + ip route add default via "$GW" + echo "nameserver $DNS" > /etc/resolv.conf + echo "Done." +fi + +echo "" +ip -4 addr show "$IFACE"