[tinyipa] Fix getting MTU via dhcp

The patch updates udhcpc script to handle MTU option advertised
by DHCP server.

Change-Id: I2708b71abfe3bc24089f4a51514d362da1491c66
This commit is contained in:
Vasyl Saienko 2020-05-27 07:07:59 +00:00
parent 16a734a0ea
commit ddd631aacb
2 changed files with 22 additions and 17 deletions

View File

@ -38,23 +38,6 @@ sudo mkdir -p /etc/ipa-rescue-config
export PYTHONOPTIMIZE=1 export PYTHONOPTIMIZE=1
# Run IPA
echo "Starting Ironic Python Agent:"
date
ironic-python-agent 2>&1 | tee /var/log/ironic-python-agent.log
create_rescue_user() {
crypted_pass=$(cat /etc/ipa-rescue-config/ipa-rescue-password)
sudo adduser rescue -D -G root # no useradd
echo "rescue:$crypted_pass" | sudo chpasswd -e
sudo sh -c "echo \"rescue ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers" # no suooers.d in tiny core.
# Restart sshd with allowing password authentication
sudo sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /usr/local/etc/ssh/sshd_config
sudo /usr/local/etc/init.d/openssh restart
}
# Setup DHCP network # Setup DHCP network
configure_dhcp_network() { configure_dhcp_network() {
for pidfile in `ls /var/run/udhcpc*.pid`; do for pidfile in `ls /var/run/udhcpc*.pid`; do
@ -74,8 +57,29 @@ configure_dhcp_network() {
ip addr && true ip addr && true
} }
# Configure networking, use custom udhcpc script to handle MTU option
configure_dhcp_network
# Run IPA
echo "Starting Ironic Python Agent:"
date
ironic-python-agent 2>&1 | tee /var/log/ironic-python-agent.log
create_rescue_user() {
crypted_pass=$(cat /etc/ipa-rescue-config/ipa-rescue-password)
sudo adduser rescue -D -G root # no useradd
echo "rescue:$crypted_pass" | sudo chpasswd -e
sudo sh -c "echo \"rescue ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers" # no suooers.d in tiny core.
# Restart sshd with allowing password authentication
sudo sed -i -e 's/^PasswordAuthentication no/PasswordAuthentication yes/' /usr/local/etc/ssh/sshd_config
sudo /usr/local/etc/init.d/openssh restart
}
if [ -f /etc/ipa-rescue-config/ipa-rescue-password ]; then if [ -f /etc/ipa-rescue-config/ipa-rescue-password ]; then
create_rescue_user || exit 0 create_rescue_user || exit 0
# The network might change during rescue, renew addresses in this case.
configure_dhcp_network || exit 0 configure_dhcp_network || exit 0
else else
echo "IPA has exited. No rescue password file was defined." echo "IPA has exited. No rescue password file was defined."

View File

@ -37,6 +37,7 @@ case "$1" in
echo adding dns $i echo adding dns $i
echo nameserver $i >> $RESOLV_CONF echo nameserver $i >> $RESOLV_CONF
done done
[ -n "$mtu" ] && /sbin/ifconfig $interface mtu $mtu
;; ;;
esac esac