35 lines
672 B
Bash
35 lines
672 B
Bash
#!/bin/bash
|
|
|
|
# --- CONFIGURATION ---
|
|
# Use Env Vars if provided, otherwise use these defaults
|
|
IP=${STATIC_IP:-"192.168.0.115/24"}
|
|
GW=${STATIC_GW:-"192.168.0.1"}
|
|
DNS=${STATIC_DNS:-"192.168.0.113"}
|
|
|
|
echo "--- Network Init ---"
|
|
echo "Using IP: $IP"
|
|
echo "Using Gateway: $GW"
|
|
echo "Using DNS: $DNS"
|
|
|
|
# 1. Generate Network Config
|
|
cat <<EOF > /etc/network/interfaces
|
|
auto lo
|
|
iface lo inet loopback
|
|
|
|
auto eth0
|
|
iface eth0 inet static
|
|
address $IP
|
|
gateway $GW
|
|
EOF
|
|
|
|
# 2. Set DNS
|
|
echo "nameserver $DNS" > /etc/resolv.conf
|
|
|
|
# 3. Wait for Hardware & Start Network
|
|
sleep 5
|
|
/sbin/ifup --force eth0
|
|
|
|
# 4. Launch App
|
|
echo "--- Starting Application ---"
|
|
exec /app/entrypoint.sh "$@"
|