install.sh 643 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. SCRIPT=`readlink -f "${BASH_SOURCE[0]}"`
  3. DIR=`dirname $SCRIPT`
  4. MOD=graphene-ipc
  5. MODNAME=graphene_ipc
  6. VER=0.0.1
  7. /sbin/lsmod | grep -q $MODNAME
  8. if [ $? -eq 0 ]; then
  9. echo "$MOD already running"
  10. exit 0
  11. fi
  12. /usr/sbin/dkms status | grep -q $MOD
  13. if [ $? -eq 0 ]; then
  14. modprobe $MOD || exit $?
  15. echo "$MOD loaded"
  16. exit 0
  17. fi
  18. dkms add $DIR || exit $?
  19. dkms build -m $MOD -v $VER
  20. if [ $? -ne 0 ]; then
  21. err=$?
  22. rm -rf /usr/src/$MOD-$VER
  23. exit $err
  24. fi
  25. dkms install -m $MOD -v $VER
  26. if [ $? -ne 0 ]; then
  27. err=$?
  28. dkms remove $MOD/$VER --all
  29. rm -rf /usr/src/$MOD-$VER
  30. exit $err
  31. fi
  32. modprobe $MOD || exit $?
  33. echo "$MOD loaded"