X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage2%2Fbootscripts%2Fifup;h=b8fc5e801cb618f0a663b00351a1867b623ce6b6;hb=f920c7ef750f2163b9e407cc453b192ede2c185a;hp=7fb88d377cafc9d3ee30d0412cba2cdfa123098b;hpb=f9cf3632a64429991fa5e6f556b0c4017e0e9435;p=hvlinux.git diff --git a/stage2/bootscripts/ifup b/stage2/bootscripts/ifup index 7fb88d3..b8fc5e8 100755 --- a/stage2/bootscripts/ifup +++ b/stage2/bootscripts/ifup @@ -23,6 +23,12 @@ check_brctl() fi } +# First make sure interface is available +if ! ip link show ${DEVICE} ; then + echo "Interface ${DEVICE} not available" + exit ${EXIT_CODE_WARNING} +fi + # Determining if the interface is a bridge: if [ "x${BRIDGE}" = "xyes" ]; then check_brctl @@ -57,6 +63,15 @@ elif [ x${BOOTPROTO} = "xstatic" ]; then # Static configuration cmd_run_log ip addr add ${IPADDR}/${PREFIX_LENGTH} dev ${DEVICE} brd + ${IFSCOPE} && cmd_run_log ip link set ${DEVICE} up + + if [ -n "${GATEWAY}" ]; then + if ip route | grep -q default; then + msg_log "Gateway already setup; skipping." + else + cmd_run_log_box "Adding default route to gateway ${GATEWAY}" \ + ip route add default via ${GATEWAY} dev ${DEVICE} + fi + fi elif [ x${BOOTPROTO} = "xpppoe" ]; then # PPPoE configuration cmd_run_log pppoe-start