-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sh
executable file
·53 lines (47 loc) · 1.47 KB
/
build.sh
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
47
48
49
50
51
52
53
#!/bin/bash
platform=`uname`
git submodule update --init --recursive
if [ "$platform" = "Linux" ];then
sudo apt install -y libx11-dev xorg-dev libxtst-dev
sudo apt install -y xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev libxkbcommon-dev
sudo apt install -y xsel xclip
fi
echo "preper..."
go mod tidy
echo "build..."
go build -ldflags "-s -w" ./cmd/sshx
go build -ldflags "-s -w" ./cmd/signaling
echo "$1"
if [ "$1" = "install" ];then
echo "build for ${platform}"
if [ "$platform" = "Linux" ];then
xhost +
sudo cp ./sshx /usr/local/bin/
sudo cp ./scripts/sshx.service /etc/systemd/system/
sudo mkdir -p /etc/sshx
sudo chmod -R 777 /etc/sshx
sudo cp -rf ./static /etc/sshx/noVNC
sudo systemctl enable sshx.service
sudo systemctl start sshx.service
elif [ "$platform" = "Darwin" ];then
sudo cp ./sshx /usr/local/bin/
sudo cp ./scripts/com.sshx.sshxd.plist /Library/LaunchDaemons/
sudo mkdir -p /etc/sshx
sudo chmod -R 777 /etc/sshx
sudo cp -rf ./static /etc/sshx/noVNC
sudo launchctl load /Library/LaunchDaemons/com.sshx.sshxd.plist
else
echo "TODO: ${platform}"
fi
if [ "$2" = "signaling" ];then
if [ "$platform" = "Linux" ];then
cp ./scripts/signaling /usr/local/bin/
cp ./scripts/signaling.service /etc/systemd/system/
systemctl enable signaling.service
systemctl start signaling.service
else
echo "TODO: $platform"
fi
fi
fi
echo "Build successfully"