install.sh 618 B

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