Add Gentoo to the dhcp-all-interfaces element

This makes use of the dhcpcd package and it's ability to run on all
interfaces by default.  We disable the privacy extensions and dhcp
overriding the hostname (both are enabled by default).  Other than
that it 'just works' and was the method used to bring up interfaces
on Gentoo Openstack images before we switched to building with DIB.

Change-Id: I02c14927d70b22f560c6fc149fefca0f93933f56
This commit is contained in:
Matthew Thode 2016-03-30 19:48:19 -05:00
parent a7fd0aebd9
commit de0cddc390
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
6 changed files with 34 additions and 4 deletions

View File

@ -9,6 +9,11 @@ to know ahead of time which one is which, so we will simply run a
DHCP client on all interfaces with real MAC addresses (except lo) that DHCP client on all interfaces with real MAC addresses (except lo) that
are visible on the first boot. are visible on the first boot.
The script /usr/local/sbin/dhcp-all-interfaces.sh will be called On non-Gentoo based distributions the script
early in each boot and will scan available network interfaces and /usr/local/sbin/dhcp-all-interfaces.sh will be called early in each
ensure they are configured properly before networking services are started. boot and will scan available network interfaces and ensure they are
configured properly before networking services are started.
On Gentoo based distributions we will install the dhcpcd package and
ensure the service starts at boot. This service automatically sets
up all interfaces found via dhcp and/or dhcpv6 (or SLAAC).

View File

@ -0,0 +1,2 @@
package-installs
pkg-map

View File

@ -8,7 +8,10 @@ set -o pipefail
SCRIPTDIR=$(dirname $0) SCRIPTDIR=$(dirname $0)
# this script is not needed on Gentoo.
if [ "$DISTRO_NAME" != "gentoo" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh
fi
DIB_INIT_SYSTEM=$(dib-init-system) DIB_INIT_SYSTEM=$(dib-init-system)
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
@ -19,4 +22,10 @@ elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces
update-rc.d dhcp-all-interfaces defaults update-rc.d dhcp-all-interfaces defaults
elif [ "$DISTRO_NAME" == "gentoo" ]; then
# let ipv6 use normal slaac
sed -i 's/slaac/#slaac/g' /etc/dhcpcd.conf
# don't let dhcpcd set domain name or hostname
sed -i 's/domain_name\,\ domain_search\,\ host_name/domain_search/g' /etc/dhcpcd.conf
rc-update add dhcpcd default
fi fi

View File

@ -18,6 +18,9 @@ rm -f /etc/network/interfaces.d/eth0.cfg
# Debian # Debian
rm -f /etc/network/interfaces.d/eth0 rm -f /etc/network/interfaces.d/eth0
# Gentoo
rm -f /etc/conf.d/net*
# /etc/network/interfaces distributions # /etc/network/interfaces distributions
if [ -f "/etc/network/interfaces" ]; then if [ -f "/etc/network/interfaces" ]; then
printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces

View File

@ -0,0 +1 @@
dhcpcd:

View File

@ -0,0 +1,10 @@
{
"family": {
"gentoo": {
"dhcpcd": "net-misc/dhcpcd"
}
},
"default": {
"dhcpcd": ""
}
}