#!/bin/bash # # This script checks whether the nvidia kernel module was loaded by udev # and copies the kernel modules over to stage4 and disables nouveau type emergency_shell >/dev/null 2>&1 || . /lib/dracut-lib.sh copy_nvidia_modules() { local nvidia_moddir="/lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nvidia" if [ -d "${NEWROOT}/${nvidia_moddir}" ]; then warn "Stage4 contains nvidia driver which would be overwritten - skipping." return 1 fi if ! ( cp -r "$nvidia_moddir" "${NEWROOT}/${nvidia_moddir}" \ && depmod -a -b "$NEWROOT" ); then warn "Failed to copy/depmod nvidia modules to stage4." return 1 fi # nouveau driver would needlessly load, prevent that mkdir -p "${NEWROOT}/etc/modprobe.d" # cause why not echo "blacklist nouveau" > "${NEWROOT}/etc/modprobe.d/disable-nouveau.conf" return 0 } if lsmod | grep -q '^nvidia'; then copy_nvidia_modules fi : # fake success