mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Compare commits
2 Commits
e3e2ad0f37
...
bfc31b6d35
Author | SHA1 | Date | |
---|---|---|---|
|
bfc31b6d35 | ||
|
42a5ac80ce |
|
@ -16,7 +16,7 @@ installDeps() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
checkHardware() {
|
checkNvidiaHardware() {
|
||||||
# Refer https://nouveau.freedesktop.org/CodeNames.html for model code names
|
# Refer https://nouveau.freedesktop.org/CodeNames.html for model code names
|
||||||
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2)
|
model=$(lspci -k | grep -A 2 -E "(VGA|3D)" | grep NVIDIA | sed 's/.*Corporation //;s/ .*//' | cut -c 1-2)
|
||||||
case "$model" in
|
case "$model" in
|
||||||
|
@ -26,6 +26,11 @@ checkHardware() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkIntelHardware() {
|
||||||
|
model=$(grep "model name" /proc/cpuinfo | head -n 1 | cut -d ':' -f 2 | cut -c 2-3)
|
||||||
|
[ "$model" -ge 11 ]
|
||||||
|
}
|
||||||
|
|
||||||
promptUser() {
|
promptUser() {
|
||||||
printf "%b" "Do you want to $1 ? [y/N]:"
|
printf "%b" "Do you want to $1 ? [y/N]:"
|
||||||
read -r confirm
|
read -r confirm
|
||||||
|
@ -82,7 +87,7 @@ setupHardwareAcceleration() {
|
||||||
|
|
||||||
installDriver() {
|
installDriver() {
|
||||||
# Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection
|
# Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection
|
||||||
if checkHardware && promptUser "install nvidia's open source drivers"; then
|
if checkNvidiaHardware && promptUser "install nvidia's open source drivers"; then
|
||||||
printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}"
|
printf "%b\n" "${YELLOW}Installing nvidia open source driver...${RC}"
|
||||||
installDeps
|
installDeps
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-open-dkms
|
||||||
|
@ -92,6 +97,10 @@ installDriver() {
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms
|
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if checkIntelHardware; then
|
||||||
|
setKernelParam "ibt=off"
|
||||||
|
fi
|
||||||
|
|
||||||
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend
|
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend
|
||||||
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||||
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
|
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
|
||||||
|
|
Loading…
Reference in New Issue
Block a user