sonic-buildimage/files/initramfs-tools/mgmt-intf-dhcp
padmanarayana 02b62ac9bb [fast-reboot]: Support OS9 -> SONiC fast-reboot migration (#1414)
* Support OS9 -> SONiC fast-reboot migration

* Address review comments. Update NOS mac in EEPROM and net.rules for eth0

* Address review comments. Update sonic-platform-modules-dell to fac81d...

* Fix script for POSIX compliance
2018-03-08 16:42:41 -08:00

37 lines
887 B
Bash

#!/bin/sh
PREREQS="union-mount"
prereqs() { echo "$PREREQS"; }
case $1 in
prereqs)
prereqs
exit 0
;;
esac
# Extract kernel parameters
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
mgmt-intf-dhcp=*)
val="${x#mgmt-intf-dhcp=}"
if [ -z "$val" ]; then
echo "ERROR: mgmt-intf-dhcp value (on/off) not specified !"
exit 0
fi
if [ -e "${rootmnt}/etc/network/interfaces" ]; then
if [ "$val" = "off" ]; then
sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' ${rootmnt}/etc/network/interfaces
elif [ "$val" = "on" ]; then
sed -i 's/iface eth0 inet static/iface eth0 inet dhcp/g' ${rootmnt}/etc/network/interfaces
fi
fi
;;
esac
done