diff --git a/quickemu b/quickemu index 9b65359..41f1623 100755 --- a/quickemu +++ b/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."