single-gpu-passthrough/install_hooks.sh

32 lines
848 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
2020-10-13 05:43:00 +00:00
if test -e /bin/vfio-startup.sh;
then
2020-10-13 02:07:46 +00:00
mv /bin/vfio-startup.sh /bin/vfio-startup.sh.bkp
fi
2020-10-13 05:43:00 +00:00
if test -e /bin/vfio-teardown.sh;
then
2020-10-13 02:07:46 +00:00
mv /bin/vfio-teardown.sh /bin/vfio-teardown.sh.bkp
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.sh /bin/vfio-startup.sh
cp hooks/vfio-teardown.sh /bin/vfio-teardown.sh
cp hooks/qemu /etc/libvirt/hooks/qemu
chmod +x /bin/vfio-startup.sh
chmod +x /bin/vfio-teardown.sh
chmod +x /etc/libvirt/hooks/qemu