2014-04-11 18:16:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-03-29 03:28:22 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2021-02-16 08:29:42 +00:00
|
|
|
# Cloud images may hard code interfaces so they
|
2014-04-17 03:45:46 +00:00
|
|
|
# boot with DHCP.
|
2014-04-11 18:16:10 +00:00
|
|
|
|
2021-02-16 08:29:42 +00:00
|
|
|
# RHEL/CentOS/Fedora
|
|
|
|
for ifcfg in $(ls /etc/sysconfig/network-scripts/ifcfg-* | grep -v "ifcfg-lo"); do
|
|
|
|
rm -f $ifcfg
|
|
|
|
done
|
2014-04-11 18:16:10 +00:00
|
|
|
|
2021-02-16 08:29:42 +00:00
|
|
|
# Ubuntu/Debian
|
|
|
|
rm -f /etc/network/interfaces.d/*
|
2014-10-09 12:33:01 +00:00
|
|
|
|
2016-03-31 00:48:19 +00:00
|
|
|
# Gentoo
|
|
|
|
rm -f /etc/conf.d/net*
|
|
|
|
|
2014-10-09 12:33:01 +00:00
|
|
|
# /etc/network/interfaces distributions
|
|
|
|
if [ -f "/etc/network/interfaces" ]; then
|
|
|
|
printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces
|
|
|
|
if [ -d "/etc/network/interfaces.d/" ]; then
|
2018-04-19 10:00:13 +00:00
|
|
|
if [ "$DISTRO_NAME" == "ubuntu" ] && [ "$DIB_RELEASE" == "trusty" ]; then
|
|
|
|
printf "source-directory interfaces.d\n\n" >> /etc/network/interfaces
|
|
|
|
else
|
|
|
|
printf "source /etc/network/interfaces.d/*\n\n" >> /etc/network/interfaces
|
|
|
|
fi
|
2014-10-09 12:33:01 +00:00
|
|
|
fi
|
|
|
|
fi
|