1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/bin/bash
- sudo apt-get update
- sudo apt-get upgrade -y
- sudo apt-get install usbip -y
- if ! grep "usbip-core" /etc/modules >/dev/null
- then
- echo "Modification modules:"
- echo "usbip-core" >> /etc/modules
- echo "usbip-host" >> /etc/modules
- echo "usbip-vudc" >> /etc/modules
- echo "ok"
- fi
- echo -e "List devices"
- usbip list -l
- read -r -p 'Chosse Device :' device
- if [ -f test ]
- then
- rm test
- fi
- echo "Build startup"
- cat <<'EOF'>> test
- #!/bin/sh -e
- ### BEGIN INIT INFO
- # Provides: usbip
- # Required-Start: networking
- # Default-Start: 3 4 5
- # Default-Stop: 0 6
- ### END INIT INFO
- sudo usbip bind -b XXXX
- sudo usbipd -D
- exit 0
- EOF
- sed -i -e "s/XXXX/$device/g" test
- chmod +x test
- sudo cp test /etc/init.d/usbip
- sudo rm test
- sudo update-rc.d usbip defaults
- echo "done"
|