diff --git a/elements/dhcp-all-interfaces/README.rst b/elements/dhcp-all-interfaces/README.rst index 8a64b9c8b..dd7a3f8ca 100644 --- a/elements/dhcp-all-interfaces/README.rst +++ b/elements/dhcp-all-interfaces/README.rst @@ -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). diff --git a/elements/dhcp-all-interfaces/element-deps b/elements/dhcp-all-interfaces/element-deps new file mode 100644 index 000000000..73015c249 --- /dev/null +++ b/elements/dhcp-all-interfaces/element-deps @@ -0,0 +1,2 @@ +package-installs +pkg-map diff --git a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index 7b58e04f7..f17b23a7a 100755 --- a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -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 diff --git a/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces b/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces index 6d2cc6213..4cfd0de78 100755 --- a/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces +++ b/elements/dhcp-all-interfaces/install.d/60-remove-cloud-image-interfaces @@ -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 diff --git a/elements/dhcp-all-interfaces/package-installs.yaml b/elements/dhcp-all-interfaces/package-installs.yaml new file mode 100644 index 000000000..b1f71dfa9 --- /dev/null +++ b/elements/dhcp-all-interfaces/package-installs.yaml @@ -0,0 +1 @@ +dhcpcd: diff --git a/elements/dhcp-all-interfaces/pkg-map b/elements/dhcp-all-interfaces/pkg-map new file mode 100644 index 000000000..b2a2d8deb --- /dev/null +++ b/elements/dhcp-all-interfaces/pkg-map @@ -0,0 +1,10 @@ +{ + "family": { + "gentoo": { + "dhcpcd": "net-misc/dhcpcd" + } + }, + "default": { + "dhcpcd": "" + } +}