Linux-Single-GPU-Passthrough/install_hooks.sh

32 lines
912 B
Bash
Raw Normal View History

2020-10-13 02:07:46 +00:00
#!/bin/bash
2021-04-09 11:50:38 +00:00
if test -e /etc/libvirt/ && ! test -e /etc/libvirt/hooks;
then
mkdir -p /etc/libvirt/hooks;
fi
2020-10-13 05:43:00 +00:00
if test -e /etc/libvirt/hooks/qemu;
then
2020-10-13 02:07:46 +00:00
mv /etc/libvirt/hooks/qemu /etc/libvirt/hooks/qemu_last_backup
fi
if test -e /usr/local/bin/vfio-startup;
2020-10-13 05:43:00 +00:00
then
mv /usr/local/bin/vfio-startup /usr/local/bin/vfio-startup.bkp
2020-10-13 02:07:46 +00:00
fi
if test -e /usr/local/bin/vfio-teardown;
2020-10-13 05:43:00 +00:00
then
mv /usr/local/bin/vfio-teardown /usr/local/bin/vfio-teardown.bkp
2020-10-13 02:07:46 +00:00
fi
2020-10-13 05:43:00 +00:00
if test -e /etc/systemd/system/libvirt-nosleep@.service;
then
2020-10-13 02:07:46 +00:00
rm /etc/systemd/system/libvirt-nosleep@.service
fi
cp systemd-no-sleep/libvirt-nosleep@.service /etc/systemd/system/libvirt-nosleep@.service
cp hooks/vfio-startup /usr/local/bin/vfio-startup
cp hooks/vfio-teardown /usr/local/bin/vfio-teardown
2020-10-13 02:07:46 +00:00
cp hooks/qemu /etc/libvirt/hooks/qemu
chmod +x /usr/local/bin/vfio-startup
chmod +x /usr/local/bin/vfio-teardown
2020-10-13 02:07:46 +00:00
chmod +x /etc/libvirt/hooks/qemu