- dropbear: custom init removes 'need net', only needs localmount + bee-sshsetup - bee-network: removed 'before dropbear' dependency - bee-network.sh: removed set -e so single iface failure does not abort script
35 lines
1004 B
Bash
35 lines
1004 B
Bash
#!/bin/sh
|
|
# bee-network.sh — bring up all physical network interfaces via DHCP
|
|
# Unattended: runs silently, logs results, never blocks.
|
|
|
|
LOG_PREFIX="bee-network"
|
|
|
|
log() { echo "[$LOG_PREFIX] $*"; }
|
|
|
|
# find physical interfaces: exclude lo and virtual (docker/virbr/veth/tun/tap)
|
|
interfaces=$(ip -o link show \
|
|
| awk -F': ' '{print $2}' \
|
|
| grep -v '^lo$' \
|
|
| grep -vE '^(docker|virbr|veth|tun|tap|br-|bond|dummy)' \
|
|
| sort)
|
|
|
|
if [ -z "$interfaces" ]; then
|
|
log "no physical interfaces found"
|
|
exit 0
|
|
fi
|
|
|
|
for iface in $interfaces; do
|
|
log "bringing up $iface"
|
|
ip link set "$iface" up 2>/dev/null || { log "WARN: could not bring up $iface"; continue; }
|
|
|
|
# DHCP: 3 retries, 5s timeout per try, exit without blocking if no offer
|
|
if udhcpc -i "$iface" -t 3 -T 5 -n -q 2>/dev/null; then
|
|
IP=$(ip -4 addr show "$iface" | awk '/inet /{print $2}' | head -1)
|
|
log "OK: $iface got $IP"
|
|
else
|
|
log "WARN: $iface — no DHCP offer"
|
|
fi
|
|
done
|
|
|
|
log "done"
|