mirror of
https://github.com/Frogging-Family/nvidia-all
synced 2024-11-01 09:20:18 +00:00
55 lines
1.1 KiB
Plaintext
55 lines
1.1 KiB
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
|
||
|
echo ""
|
||
|
echo -e "\e[31m###########################################################\e[0m"
|
||
|
echo ""
|
||
|
echo -e "\e[31m It is recommended to run mkinitcpio -P after installation\e[0m"
|
||
|
echo ""
|
||
|
echo -e "\e[31m###########################################################\e[0m"
|
||
|
echo ""
|
||
|
}
|
||
|
|
||
|
post_upgrade() {
|
||
|
_depmod
|
||
|
|
||
|
# Not rebuilding?
|
||
|
if (( $(vercmp $1 $2) != 0 )); then
|
||
|
_rmmod
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
post_remove() {
|
||
|
_depmod
|
||
|
|
||
|
_rmmod
|
||
|
}
|