mirror of
https://github.com/Frogging-Family/nvidia-all
synced 2024-10-30 15:20:10 +00:00
48 lines
833 B
Plaintext
48 lines
833 B
Plaintext
|
_depmod() {
|
||
|
# Update module dependencies for all kernels
|
||
|
local -a _kernels
|
||
|
mapfile -t _kernels < <(find /usr/lib/modules/*/build/version -exec cat {} +)
|
||
|
for _kernel in "${_kernels[@]}"; do
|
||
|
depmod $_kernel
|
||
|
done
|
||
|
}
|
||
|
|
||
|
_rmmod() {
|
||
|
# Try unloading
|
||
|
if lsmod | grep -q nvidia; then
|
||
|
rmmod nvidia
|
||
|
fi
|
||
|
|
||
|
# What?
|
||
|
if [[ $? != 0 ]]; then
|
||
|
# X running?
|
||
|
if pidof Xorg >/dev/null; then
|
||
|
echo ":: Please reboot or exit X first."
|
||
|
fi
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
post_install() {
|
||
|
_depmod
|
||
|
|
||
|
# X running?
|
||
|
if pidof Xorg >/dev/null; then
|
||
|
echo ":: Please reboot or exit X to unload the current module."
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
post_upgrade() {
|
||
|
_depmod
|
||
|
|
||
|
# Not rebuilding?
|
||
|
if (( $(vercmp $1 $2) != 0 )); then
|
||
|
_rmmod
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
post_remove() {
|
||
|
_depmod
|
||
|
|
||
|
_rmmod
|
||
|
}
|