Merge "Make DHCP timeout configurable"

This commit is contained in:
Jenkins 2017-01-13 06:19:54 +00:00 committed by Gerrit Code Review
commit 753ab9a019
3 changed files with 12 additions and 1 deletions

View File

@ -17,3 +17,13 @@ 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).
Environment Variables
---------------------
DIB_DHCP_TIMEOUT
:Required: No
:Default: 30
:Description: Amount of time in seconds that the systemd service will
wait to get an address.
:Example: DIB_DHCP_TIMEOUT=300

View File

@ -24,6 +24,7 @@ if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules
sed -i "s/TimeoutStartSec=DIB_DHCP_TIMEOUT/TimeoutStartSec=${DIB_DHCP_TIMEOUT:-30}s/" /usr/lib/systemd/system/dhcp-interface@.service
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

View File

@ -15,7 +15,7 @@ User=root
ExecStartPre=/usr/local/sbin/dhcp-all-interfaces.sh %I
ExecStart=/sbin/ifup %I
RemainAfterExit=true
TimeoutStartSec=30s
TimeoutStartSec=DIB_DHCP_TIMEOUT
[Install]
WantedBy=multi-user.target