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:
parent
a7fd0aebd9
commit
de0cddc390
@ -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
|
||||
are visible on the first boot.
|
||||
|
||||
The script /usr/local/sbin/dhcp-all-interfaces.sh will be called
|
||||
early in each boot and will scan available network interfaces and
|
||||
ensure they are configured properly before networking services are started.
|
||||
On non-Gentoo based distributions the script
|
||||
/usr/local/sbin/dhcp-all-interfaces.sh will be called early in each
|
||||
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).
|
||||
|
2
elements/dhcp-all-interfaces/element-deps
Normal file
2
elements/dhcp-all-interfaces/element-deps
Normal file
@ -0,0 +1,2 @@
|
||||
package-installs
|
||||
pkg-map
|
@ -8,7 +8,10 @@ set -o pipefail
|
||||
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
|
||||
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh
|
||||
# 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
|
||||
fi
|
||||
|
||||
DIB_INIT_SYSTEM=$(dib-init-system)
|
||||
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
|
||||
@ -19,4 +22,10 @@ elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; 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
|
||||
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
|
||||
|
@ -18,6 +18,9 @@ rm -f /etc/network/interfaces.d/eth0.cfg
|
||||
# Debian
|
||||
rm -f /etc/network/interfaces.d/eth0
|
||||
|
||||
# Gentoo
|
||||
rm -f /etc/conf.d/net*
|
||||
|
||||
# /etc/network/interfaces distributions
|
||||
if [ -f "/etc/network/interfaces" ]; then
|
||||
printf "auto lo\niface lo inet loopback\n\n" > /etc/network/interfaces
|
||||
|
1
elements/dhcp-all-interfaces/package-installs.yaml
Normal file
1
elements/dhcp-all-interfaces/package-installs.yaml
Normal file
@ -0,0 +1 @@
|
||||
dhcpcd:
|
10
elements/dhcp-all-interfaces/pkg-map
Normal file
10
elements/dhcp-all-interfaces/pkg-map
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"family": {
|
||||
"gentoo": {
|
||||
"dhcpcd": "net-misc/dhcpcd"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"dhcpcd": ""
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user