nvidia-all/system/nvidia-tkg.install
Cabopust 1bb6d2e88f
Adding a hook to automatically update initramfs images (#63)
* Add a hook to automatically update initramfs images

* Removing the warning about manually updating initramfs
2021-10-08 16:52:35 +02:00

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
}