#!/bin/bash if lsmod | grep $1 &> /dev/null ; then echo reloading $1 else echo usage: kms-reload module-name exit fi Xstop echo 0 > /sys/class/vtconsole/vtcon1/bind if [ "$1" == "i915" ]; then rmmod intel_ips &> /dev/null rmmod intel-gtt &> /dev/null fi rmmod $1 #rmmod drm_kms_helper #rmmod drm if lsmod | grep $1 &> /dev/null ; then echo WARNING: $1 still loaded! exitcode=1 else echo module $1 successfully unloaded exitcode=0 fi modprobe $1 echo 1 > /sys/class/vtconsole/vtcon1/bind Xstart exit $exitcode