#!/bin/bash
set -eux

# Be sure to copy existing interface configs from the host so that we can properly
# ifdown them before bringing up new config.
cp /host/etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/

NET_CONFIG=$(os-apply-config --key os_net_config --type raw --key-default '')

if [ -n "$NET_CONFIG" ]; then
    os-net-config -c /etc/os-net-config/config.json -v
fi
