-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathinstall_server
46 lines (44 loc) · 1.09 KB
/
install_server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
echo "Please run with sudo"
exit 1
fi
if [ -n "$1" ]; then
FILENAME="$1"
else
ARCH=$(uname -m)
if [ -z "${ARCH##*arm*}" ]; then
FILENAME="vhusbdarm"
elif [ "$ARCH" = "mips" ]; then
FILENAME="vhusbdmips"
elif [ "$ARCH" = "mipsel" ]; then
FILENAME="vhusbdmipsel"
elif [ -z "${ARCH##*x86_64*}" ]; then
FILENAME="vhusbdx86_64"
elif [ -z "${ARCH##*aarch64*}" ]; then
FILENAME="vhusbdarm64"
else
FILENAME="vhusbdi386"
fi
fi
wget https://www.virtualhere.com/sites/default/files/usbserver/$FILENAME
chmod +x $FILENAME
mv $FILENAME /usr/local/sbin
mkdir -p /usr/local/etc/virtualhere
if [ -d "/etc/systemd/system" ]; then
cat << EOF > /etc/systemd/system/virtualhere.service
[Unit]
Description=VirtualHere Server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/sbin/$FILENAME -b -c /usr/local/etc/virtualhere/config.ini
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable virtualhere.service
systemctl start virtualhere.service
else
echo "Error, only systemd is supported"
fi