xcat-core/xCAT/postscripts/disableconsistentNICrename

17 lines
667 B
Plaintext
Executable File

#/bin/sh
#modify the grub.cfg to prevent nic consistent network renameing
grep -E -q "net.ifnames=0" /etc/sysconfig/grub || sed -i '/^GRUB_CMDLINE_LINUX=.*/{s/"$/ net.ifnames=0"/}' /etc/sysconfig/grub
grep -E -q "net.ifnames=0" /etc/default/grub || sed -i '/^GRUB_CMDLINE_LINUX=.*/{s/"$/ net.ifnames=0"/}' /etc/default/grub
if [ -f "/boot/efi/EFI/redhat/grub.cfg" ];then
GRUB_CFG_FILE="/boot/efi/EFI/redhat/grub.cfg"
#elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then
elif [ -f "/boot/grub2/grub.cfg" ];then
GRUB_CFG_FILE="/boot/grub2/grub.cfg"
elif [ -f "/boot/grub/grub.cfg" ];then
GRUB_CFG_FILE="/boot/grub/grub.cfg"
fi
grub2-mkconfig -o "$GRUB_CFG_FILE"