Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VirtualHere USB Service (Download Server from https://www.virtualhere.com/usb_server_software)
#!/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
[Unit]
Description=VirtualHere USB Client
[Service]
ExecStart=/usr/local/bin/vhusbdarm -b
Type=forking
[Install]
WantedBy=default.target
@johannrichard

This comment has been minimized.

Copy link
Owner Author

commented Jul 10, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.