install.sh 777 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. sudo apt-get update
  3. sudo apt-get upgrade -y
  4. sudo apt-get install usbip -y
  5. if ! grep "usbip-core" /etc/modules >/dev/null
  6. then
  7. echo "Modification modules:"
  8. echo "usbip-core" >> /etc/modules
  9. echo "usbip-host" >> /etc/modules
  10. echo "usbip-vudc" >> /etc/modules
  11. echo "ok"
  12. fi
  13. echo -e "List devices"
  14. usbip list -l
  15. read -r -p 'Chosse Device :' device
  16. if [ -f test ]
  17. then
  18. rm test
  19. fi
  20. echo "Build startup"
  21. cat <<'EOF'>> test
  22. #!/bin/sh -e
  23. ### BEGIN INIT INFO
  24. # Provides: usbip
  25. # Required-Start: networking
  26. # Default-Start: 3 4 5
  27. # Default-Stop: 0 6
  28. ### END INIT INFO
  29. sudo usbip bind -b XXXX
  30. sudo usbipd -D
  31. exit 0
  32. EOF
  33. sed -i -e "s/XXXX/$device/g" test
  34. chmod +x test
  35. sudo cp test /etc/init.d/usbip
  36. sudo rm test
  37. sudo update-rc.d usbip defaults
  38. echo "done"