Experimenting with VFIO. Add script to turn it on or off.
This commit is contained in:
parent
25680431e0
commit
d8e2284059
38
scripts/.local/bin/vfio.sh
Executable file
38
scripts/.local/bin/vfio.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "This script must be run as root. Quitting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "on" ]; then
|
||||
if grep "#MODULES=()" /etc/mkinitcpio.conf &> /dev/null; then
|
||||
echo "VFIO is already enabled. Quitting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Enabling VFIO..."
|
||||
|
||||
sed -i 's/MODULES=()/#MODULES=()/g' /etc/mkinitcpio.conf
|
||||
sed -i 's/#MODULES=(vfio/MODULES=(vfio/g' /etc/mkinitcpio.conf
|
||||
elif [ "$1" = "off" ]; then
|
||||
if grep "#MODULES=(vfio" /etc/mkinitcpio.conf &> /dev/null; then
|
||||
echo "VFIO is already disabled. Quitting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Disabling VFIO..."
|
||||
|
||||
sed -i 's/#MODULES=()/MODULES=()/g' /etc/mkinitcpio.conf
|
||||
sed -i 's/MODULES=(vfio/#MODULES=(vfio/g' /etc/mkinitcpio.conf
|
||||
else
|
||||
echo "Please run with either 'on' or 'off' as command line argument. Quitting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 0.5
|
||||
echo "Rebuilding initramfs..."
|
||||
|
||||
mkinitcpio -P
|
||||
|
||||
echo "Done!"
|
Loading…
Reference in a new issue