post_install (){ MODULE="8192cu" DKMS=$(which dkms) MODPROBE=$(which modprobe) VERSION="v4.0.2_9000" $DKMS add -m $MODULE -v $VERSION $DKMS build -m $MODULE -v $VERSION $DKMS install -m $MODULE -v $VERSION $MODPROBE -a $MODULE } pre_upgrade(){ pre_remove } post_upgrade(){ post_install } pre_remove (){ _inmemory=$(/usr/bin/lsmod | /usr/bin/grep 8192cu) if [ ! -z "$_inmemory" ]; then /usr/bin/rmmod 8192cu &> /dev/null fi DKMS=$(which dkms) _line=$($DKMS status -m 8192cu) if echo "$_line" | grep -E 'added|built|installed'; then version=$(echo "$_line" | sed 's/8192cu,\([^,]*\)[,:].*/\1/;t;d') $DKMS remove -m 8192cu -v $version --all fi } post_remove () { /sbin/depmod -a } op=$1 shift $op $*