|
|
@ -1,19 +1,18 @@
|
|
|
|
#!/bin/bash
|
|
|
|
#!/bin/bash
|
|
|
|
function exit_script {
|
|
|
|
function exit_script() {
|
|
|
|
sleep 0.5
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.0/remove
|
|
|
|
if nvidia-smi | grep "No running processes found"; then
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.1/remove
|
|
|
|
sudo rmmod nvidia_modeset
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.2/remove
|
|
|
|
sudo rmmod nvidia
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/devices/0000:01:00.3/remove
|
|
|
|
sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._OFF" > /proc/acpi/call'
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
trap exit_script SIGINT
|
|
|
|
trap exit_script SIGINT
|
|
|
|
trap exit_script SIGTERM
|
|
|
|
trap exit_script SIGTERM
|
|
|
|
if lsmod | grep nvidia; then
|
|
|
|
if lspci | grep -i nvidia; then
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._ON" > /proc/acpi/call'
|
|
|
|
echo 1 | sudo tee /sys/bus/pci/rescan
|
|
|
|
|
|
|
|
sudo modprobe nvidia
|
|
|
|
sleep 1
|
|
|
|
sleep 1
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
vblank_mode=0 primusrun "$@"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|