Merge "Add Gentoo to the dhcp-all-interfaces element"

This commit is contained in:
Jenkins 2016-04-21 23:03:24 +00:00 committed by Gerrit Code Review
commit 33d7e8b25e
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
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).

View File

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

View File

@ -8,7 +8,10 @@ set -o pipefail
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
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

View File

@ -18,6 +18,9 @@ rm -f /etc/network/interfaces.d/eth*.cfg
# Debian
rm -f /etc/network/interfaces.d/eth*
# 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

View File

@ -0,0 +1 @@
dhcpcd:

View File

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