diff --git a/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh b/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh index 332e2fcba8..a5fd406aba 100755 --- a/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh +++ b/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh @@ -19,8 +19,13 @@ # cpu resources can be used without the risk of becoming dependent on more # memory. if [ -f /etc/default/grub ] ; then - sudo sed -i -e 's/^GRUB_TIMEOUT=[0-9]\+/GRUB_TIMEOUT=0/' -e 's/#\?GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="mem=8G"/g' /etc/default/grub - sudo update-grub + sudo sed -i -e 's/^GRUB_TIMEOUT=[0-9]\+/GRUB_TIMEOUT=0/' -e 's/#\?GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="mem=8G /g' /etc/default/grub + if which update-grub &> /dev/null ; then + sudo update-grub + else + # If update-grub isn't available, use grub2-mkconfig directly + sudo grub2-mkconfig -o /boot/grub2/grub.cfg + fi elif [ -f /boot/grub/grub.conf ] ; then sudo sed -i -e 's/^timeout=[0-9]\+/timeout=0/' -e 's/\(^\s\+kernel.*\)/\1 mem=8G/' /boot/grub/grub.conf fi