Merge "Change DHCP timeout"
This commit is contained in:
commit
2859569635
@ -27,6 +27,9 @@ MANILA_IMG_NAME=${MANILA_IMG_NAME:-"manila-service-image"}
|
||||
MANILA_SHARE_PROTO=${MANILA_SHARE_PROTO:-"default"}
|
||||
MANILA_DISTRO=${MANILA_DISTRO:-"ubuntu"}
|
||||
|
||||
#Misc settings
|
||||
DHCP_TIMEOUT=${DHCP_TIMEOUT:-"300"}
|
||||
|
||||
# Path to elements
|
||||
SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
@ -47,6 +50,7 @@ export DIB_RELEASE=$MANILA_IMG_OS_VER
|
||||
export DIB_MANILA_USER_USERNAME=$MANILA_USER
|
||||
export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD
|
||||
export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS
|
||||
export DIB_DHCP_TIMEOUT=$DHCP_TIMEOUT
|
||||
|
||||
# CLI
|
||||
# ---
|
||||
|
2
elements/manila-ssh/environment.d/99-update-dhcp-config
Executable file
2
elements/manila-ssh/environment.d/99-update-dhcp-config
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
export DIB_DHCP_TIMEOUT=${DIB_DHCP_TIMEOUT:-300}
|
28
elements/manila-ssh/install.d/99-update-dhcp-config
Executable file
28
elements/manila-ssh/install.d/99-update-dhcp-config
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
DHCP_TIMEOUT=${DIB_DHCP_TIMEOUT:-300}
|
||||
|
||||
if [ -f /etc/dhcp/dhclient.conf ] ; then
|
||||
# Set the dhclient timeout configurations to match DIB_DHCP_TIMEOUT,
|
||||
if grep -o "^timeout " /etc/dhcp/dhclient.conf ; then
|
||||
sed -i -e "s/^timeout .*/# \"timeout\" Value set by 99-update-dhcp-config\ntimeout ${DHCP_TIMEOUT};/" /etc/dhcp/dhclient.conf
|
||||
else
|
||||
echo -e "# \"timeout\" Value set by 99-update-dhcp-config\ntimeout ${DHCP_TIMEOUT};" >> /etc/dhcp/dhclient.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
DIB_INIT_SYSTEM=$(dib-init-system)
|
||||
if [ "$DIB_INIT_SYSTEM" == "systemd" ] ; then
|
||||
sudo cp /usr/lib/systemd/system/dhcp-interface@.service \
|
||||
/etc/systemd/system/dhcp-interface@.service
|
||||
sudo sed -i "s/TimeoutStartSec=.*/TimeoutStartSec=${DHCP_TIMEOUT}s/" \
|
||||
/etc/systemd/system/dhcp-interface@.service
|
||||
else
|
||||
echo "Not supported for this init system"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user