Added check if file exists in ignore_msrs_always

This commit is contained in:
Michael Tinsay 2022-10-07 09:49:09 +08:00
parent 72432bfad7
commit dba2a2b7e1

View File

@ -10,7 +10,7 @@ function ignore_msrs_always() {
# Make sure the host has /etc/modprobe.d
if [ -d /etc/modprobe.d ]; then
# Skip if ignore_msrs is already enabled, assumes initramfs has been rebuilt
if grep -lq 'ignore_msrs=Y' /etc/modprobe.d/kvm-quickemu.conf >/dev/null 2>&1; then
if [ ! -f /etc/modprobe.d/kvm-quickemu.conf ] || grep -lq 'ignore_msrs=Y' /etc/modprobe.d/kvm-quickemu.conf >/dev/null 2>&1; then
echo "options kvm ignore_msrs=Y" | sudo tee /etc/modprobe.d/kvm-quickemu.conf
sudo update-initramfs -k all -u
fi