-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu-options.sh
More file actions
76 lines (65 loc) · 2.05 KB
/
cpu-options.sh
File metadata and controls
76 lines (65 loc) · 2.05 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
### Intel CPU
echo "(I)ntel / (A)md / Enter for No"
echo "Do you want the script to configure grub for you?"
read cpu
case $cpu in
I|i|Intel|intel|INTEL)
echo "This will configure your grub config for virtualization for Intel."
GRUB=`cat /etc/default/grub | grep "^GRUB_CMDLINE_LINUX=.*" | cut -d '=' -f 2- | tr -d '"'`
#adds intel_iommu=on and iommu=pt to the grub config
GRUB="$GRUB intel_iommu=on iommu=pt video=efifb:off"
# Add the equals sign and double quotes
GRUB="GRUB_CMDLINE_LINUX=\"$GRUB\""
sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/${GRUB}/" /etc/default/grub
sh ./grub_update.sh
printf "Grub bootloader has been modified successfully, reboot time!\nthe reverted grub file is saved as /etc/default/grub.bak\nand the blacklists are in /etc/modprobe/\n"
printf "be sure to reboot if you have blacklisted any GPU's\n"
printf "press Y to reboot now and n to reboot later."
read REBOOT
if [ "${REBOOT}" = "Y" ] || [ "${REBOOT}" = "y" ]
then
reboot
exit
else
clear
sleep 1s
echo "Not rebooting"
sleep 1s
clear
fi
;;
#AMD CPU's
A|a|amd|Amd|AMD)
# sh ./grub_backup.sh
echo "This will configure your grub config for virtualization for AMD."
GRUB=`cat /etc/default/grub | grep "^GRUB_CMDLINE_LINUX=.*" | cut -d '=' -f 2- | tr -d '"'`
#adds amd_iommu=on and iommu=pt to the grub config
GRUB="$GRUB amd_iommu=on iommu=pt video=efifb:off"
# Add the equals sign and double quotes
GRUB="GRUB_CMDLINE_LINUX=\"$GRUB\""
sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/${GRUB}/" /etc/default/grub
sh ./grub_update.sh
printf "Grub bootloader has been modified successfully, reboot time!\nthe reverted grub file is saved as /etc/default/grub.bak\nand the blacklists are in /etc/modprobe/\n"
printf "be sure to reboot if you have blacklisted any GPU's\n"
printf "press Y to reboot now and n to reboot later (if you want other options)."
read REBOOT
if [ "${REBOOT}" = "Y" ] || [ "${REBOOT}" = "y" ]
then
reboot
exit
else
clear
sleep 1s
echo "Not rebooting"
sleep 1s
clear
fi
;;
*)
clear
sleep 1s
echo "Not configuring GRUB"
sleep 1s
clear
esac