forked from ilayna/Single-GPU-passthrough-amd-nvidia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_hooks.sh
executable file
·31 lines (29 loc) · 917 Bytes
/
install_hooks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# taken from https://gitlab.com/risingprismtv/single-gpu-passthrough
if test -e /etc/libvirt/ && ! test -e /etc/libvirt/hooks;
then
mkdir -p /etc/libvirt/hooks;
fi
if test -e /etc/libvirt/hooks/qemu;
then
mv /etc/libvirt/hooks/qemu /etc/libvirt/hooks/qemu_last_backup
fi
if test -e /bin/vfio-startup.sh;
then
mv /bin/vfio-startup.sh /bin/vfio-startup.sh.bkp
fi
if test -e /bin/vfio-teardown.sh;
then
mv /bin/vfio-teardown.sh /bin/vfio-teardown.sh.bkp
fi
if test -e /etc/systemd/system/libvirt-nosleep@.service;
then
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