diff --git a/postplug.d/30xorg b/postplug.d/30xorg index 5bf0123..d576b43 100644 --- a/postplug.d/30xorg +++ b/postplug.d/30xorg @@ -184,14 +184,18 @@ if [ -e $XORGCONF ]; then # assume first driver as default videodriver VIDEODRIVER=${VIDEODRIVERS[0]} - if [ "$VIDEODRIVER" = "nvidia" ]; then - [ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset` - if [ "$NOUVEAU_MODESET" = "1" ]; then - # replace nvidia with nouveau - mv $XORGCONF $XORGCONF.postplug.nvidia.save - rmmod nvidia - echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf - fi + [ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset` + + if [ "$VIDEODRIVER" = "nvidia" -a "$NUOUVEAU_MODESET" = "1" ]; then + # replace nvidia with nouveau + mv $XORGCONF $XORGCONF.postplug.nvidia.save + rmmod nvidia + echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf + elif [ "$VIDEODRIVER" = "nouveau" -a ! "$NOUVEAU_MODESET" ]; then + # replace nouveau with nvidia + mv $XORGCONF $XORGCONF.postplug.nouveau.save + rmmod nouveau + echo "blacklist nouveau" > /etc/modprobe.d/postplug-nouveau.conf fi fi