├── LICENSE ├── README.md ├── install_server └── uninstall_server /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Michael 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VirtualHere server install and uninstall script 2 | 3 | VirtualHere server install script for `systemd` based systems (e.g Raspberry 4 | Pi and most modern Linux Distributions). 5 | 6 | ## Installing default version 7 | 8 | To install the default server version for your architecture, run the following 9 | command and enter in your sudo password when prompted. 10 | 11 | curl https://raw.githubusercontent.com/virtualhere/script/main/install_server | sudo sh 12 | 13 | ## Installing optimized or custom version 14 | 15 | To install an optimized or custom version, pass the file name as a script 16 | argument. A list of optimized versions is available in the "CPU optimized 17 | builds of VirtualHere USB Server for Maximum Performance on your hardware" 18 | section of [Linux USB Server](https://www.virtualhere.com/usb_server_software) 19 | page. 20 | 21 | curl https://raw.githubusercontent.com/virtualhere/script/main/install_server | sudo sh -s - vhusbdarmpi4 22 | 23 | ## Uninstalling server 24 | 25 | To uninstall the server, run the following command. This script will remove 26 | server binary and systemd service, but it will preserve the configuration file. 27 | 28 | curl https://raw.githubusercontent.com/virtualhere/script/main/uninstall_server | sudo sh 29 | -------------------------------------------------------------------------------- /install_server: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$(id -u)" -ne 0 ]; then 3 | echo "Please run with sudo" 4 | exit 1 5 | fi 6 | if [ -n "$1" ]; then 7 | FILENAME="$1" 8 | else 9 | ARCH=$(uname -m) 10 | if [ -z "${ARCH##*arm*}" ]; then 11 | FILENAME="vhusbdarm" 12 | elif [ "$ARCH" = "mips" ]; then 13 | FILENAME="vhusbdmips" 14 | elif [ "$ARCH" = "mipsel" ]; then 15 | FILENAME="vhusbdmipsel" 16 | elif [ -z "${ARCH##*x86_64*}" ]; then 17 | FILENAME="vhusbdx86_64" 18 | elif [ -z "${ARCH##*aarch64*}" ]; then 19 | FILENAME="vhusbdarm64" 20 | else 21 | FILENAME="vhusbdi386" 22 | fi 23 | fi 24 | wget https://www.virtualhere.com/sites/default/files/usbserver/$FILENAME 25 | chmod +x $FILENAME 26 | mv $FILENAME /usr/local/sbin 27 | mkdir -p /usr/local/etc/virtualhere 28 | if [ -d "/etc/systemd/system" ]; then 29 | cat << EOF > /etc/systemd/system/virtualhere.service 30 | [Unit] 31 | Description=VirtualHere Server 32 | After=network.target 33 | 34 | [Service] 35 | Type=forking 36 | ExecStart=/usr/local/sbin/$FILENAME -b -c /usr/local/etc/virtualhere/config.ini 37 | 38 | [Install] 39 | WantedBy=multi-user.target 40 | EOF 41 | systemctl daemon-reload 42 | systemctl enable virtualhere.service 43 | systemctl start virtualhere.service 44 | else 45 | echo "Error, only systemd is supported" 46 | fi 47 | -------------------------------------------------------------------------------- /uninstall_server: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$(id -u)" -ne 0 ]; then 3 | echo "Please run with sudo" 4 | exit 1 5 | fi 6 | UNIT="/etc/systemd/system/virtualhere.service" 7 | if [ -f "$UNIT" ]; then 8 | systemctl stop virtualhere.service 9 | systemctl disable virtualhere.service 10 | FILENAME="$(awk -F'[ =]' '/ExecStart=/ {print $2}' $UNIT)" 11 | CONFIG="$(awk -F'[ =]' '/ExecStart=/ {print $5}' $UNIT)" 12 | rm "$FILENAME" "$UNIT" 13 | systemctl daemon-reload 14 | echo "Configuration file $CONFIG" 15 | echo "was not removed. Remove it manualy if you wish." 16 | else 17 | echo "Error, only systemd is supported" 18 | fi 19 | --------------------------------------------------------------------------------