Improve the grub manipulation script
This commit is contained in:
parent
f2414083d6
commit
b12a7dcf0e
1 changed files with 27 additions and 9 deletions
|
@ -1,4 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function install() {
|
||||||
|
local cmdindicator="GRUB_CMDLINE_LINUX_DEFAULT=\"";
|
||||||
|
local config="nvidia_drm.fbdev=1";
|
||||||
|
|
||||||
# According to: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
|
# According to: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
|
||||||
{
|
{
|
||||||
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1";
|
echo "options nvidia NVreg_PreserveVideoMemoryAllocations=1";
|
||||||
|
@ -9,3 +14,16 @@ sudo systemctl enable \
|
||||||
nvidia-suspend.service \
|
nvidia-suspend.service \
|
||||||
nvidia-hibernate.service \
|
nvidia-hibernate.service \
|
||||||
nvidia-resume.service;
|
nvidia-resume.service;
|
||||||
|
|
||||||
|
if ! cat /etc/default/grub | grep "$cmdindicator.*$config" > /dev/null;
|
||||||
|
then
|
||||||
|
sudo sed -i /etc/default/grub \
|
||||||
|
-e "/$cmdindicator/{" \
|
||||||
|
-e "s/\($cmdindicator.*[^ ]\)\(\"\)/\1 \2/" \
|
||||||
|
-e "s/\($cmdindicator.*\)\(\"\)/\1$config\2/" \
|
||||||
|
-e "}" \
|
||||||
|
;
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
|
install;
|
||||||
|
|
Loading…
Reference in a new issue