Implement fallback for ignore_msrs_always function
Implements fallback in the absence of 'update-initramfs' utility(the command fails on arch). The counterpart on arch would be 'mkinitcpio' (possibly mkinitcpio -p linux )
This commit is contained in:
parent
82df57dadf
commit
4360977c78
39
quickemu
39
quickemu
|
|
@ -12,7 +12,44 @@ function ignore_msrs_always() {
|
|||
# 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
|
||||
echo "options kvm ignore_msrs=Y" | sudo tee /etc/modprobe.d/kvm-quickemu.conf
|
||||
sudo update-initramfs -k all -u
|
||||
|
||||
# Code to verify if user has update-initramfs(debian exclusive? absent on arch ?) or mkinitcpio(present on arch) utility present
|
||||
|
||||
flag=0;
|
||||
man update-initramfs &>2
|
||||
a="$(echo $?)"
|
||||
# echo $a
|
||||
if [[ $a -eq 0 ]]; then
|
||||
flag=1;
|
||||
else
|
||||
man mkinitcpio &>2
|
||||
a="$(echo $?)"
|
||||
# echo $a
|
||||
if [[ "$a" -eq 0 ]]; then
|
||||
flag=2;
|
||||
else
|
||||
flag=3;
|
||||
fi
|
||||
fi
|
||||
|
||||
# echo $flag;
|
||||
|
||||
case "$flag" in
|
||||
1)
|
||||
sudo update-initramfs -k all -u
|
||||
;;
|
||||
2)
|
||||
sudo mkinitcpio -p linux
|
||||
echo "Ran mkinitcpio -p linux"
|
||||
;;
|
||||
3)
|
||||
echo "ERROR! User does not have update-initramfs or mkinitcpio installed, please find out respective utility to update/regenrate intiramfs."
|
||||
echo "Run respective command for 'sudo update-initramfs -k all -u'(debian) or 'sudo mkinitcpio -p linux'(arch)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
fi
|
||||
else
|
||||
echo "ERROR! /etc/modprobe.d was not found, I don't know how to configure this system."
|
||||
|
|
|
|||
Loading…
Reference in New Issue