-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhooks-init.sh
46 lines (38 loc) · 1.1 KB
/
hooks-init.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function hookInit() {
echo
echo "This should be ran after installing you're windows vm. Do you still want to continue? y/n"
read ANSWER
if [ ANSWER = n ]
then
echo "Exiting script..."
return 1
fi
if [ -d "/etc/libvirt/hooks/"]
then
echo "Hook Directory already exist"
return 1
else
sudo mkdir /etc/libvirt/hooks/
sudo cp ./hook-scripts/kvm.conf /etc/libvirt/hooks/kvm.conf
sudo cp ./hook-scripts/qemu /etc/libvirt/hooks/qemu
sudo chmod +x /etc/libvirt/hooks/qemu
echo
echo "[+] Creating Hook folders"
echo "what is the name of the vm? >>> "
read VM_NAME
sudo mkdir -p /etc/libvirt/hooks/qemu.d/$VM_NAME/prepare/begin
sudo mkdir -p /etc/libvirt/hooks/qemu.d/$VM_NAME/release/end
sudo chmod +x ./hook-scripts/start.sh
sudo chmod +x ./hook-scripts/revert.sh
sudo cp ./hook-scripts/start.sh /etc/libvirt/hooks/qemu.d/$VM_NAME/prepare/begin/start.sh
sudo cp ./hook-scripts/revert.sh /etc/libvirt/hooks/qemu.d/$VM_NAME/release/end/revert.sh
fi
if [ -f /bin/tree]
then
tree /etc/libvirt/hooks/
else
sudo pacman -Sy tree
tree /etc/libvirt/hooks/
fi
}
hookInit