Last active
March 16, 2018 14:05
-
-
Save johannrichard/f2aaf07966421d3152bb5e22ea29deb3 to your computer and use it in GitHub Desktop.
VirtualHere USB Service (Download Server from https://www.virtualhere.com/usb_server_software)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This little script downloads the VirtualHere USB client and sets up a service | |
# on arm-based systems | |
VHUSB_URL="https://virtualhere.com/sites/default/files/usbserver/vhusbdarm" | |
VHUSB_BINARY="/usr/local/bin/vhusbdarm" | |
VHUSB_SERVICE="/etc/systemd/system/vhusb.service" | |
if [[ `uname -m` == *"arm"* ]] | |
then | |
echo "It's an ARM architecture!"; | |
if [ ! -e "$VHUSB_BINARY" ]; then | |
echo "Attemtping to get root permissions to save 'vhusbdarm' to your system and downloading server and service script" | |
sudo wget -o "$VHUSB_BINARY" $VHUSB_URL | |
if [ -e "$VHUSB_BINARY" ]; then | |
echo "VirtualHere Binary successfully downloaded and saved as $VHUSB_BINARY. Attemting to install service at $VHUSB_SERVICE" | |
sudo /bin/cat <<EOM >$VHUSB_SERVICE | |
[Unit] | |
Description=VirtualHere USB Client | |
Requires=avahi-daemon.service | |
After=avahi-daemon.service | |
[Service] | |
ExecStart=/usr/local/bin/vhusbdarm -b | |
Type=forking | |
[Install] | |
WantedBy=default.target | |
EOM | |
else | |
echo "VirtualHere Service binary not found at $VHUSB_BINARY. Abort." | |
exit 1 | |
fi | |
else | |
echo "Binary already exists. Abort." | |
exit 1 | |
fi | |
else | |
echo "We're not on ARM architecture. Abort." | |
exit 1 | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=VirtualHere USB Client | |
[Service] | |
ExecStart=/usr/local/bin/vhusbdarm -b | |
Type=forking | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this service script to create a systemd service for VirtualHub USB (e.g. on a Raspberry Pi) to access USB devices remotely. You need to have the corrcet binary installed in /usr/local/bin (bhusbdarm for generic arm version) or adapt the path.