2020-09-22 23:10:16 +01:00
|
|
|
#!/bin/bash
|
2020-09-23 20:22:00 +01:00
|
|
|
# Check if golang exists by the output of "go version"
|
2020-09-22 23:10:16 +01:00
|
|
|
if [ "$(go version | head -c 13)" == "go version go" ]; then
|
|
|
|
echo "Assuming go is installed"
|
2020-09-23 20:22:00 +01:00
|
|
|
|
|
|
|
# Check location for simple vpn binary
|
2020-09-22 23:10:16 +01:00
|
|
|
if [ -f /usr/bin/simple-vpn ]; then
|
|
|
|
echo "Found \"/usr/bin/simple-vpn\" assuming it is installed correctly"
|
|
|
|
else
|
2020-09-23 20:22:00 +01:00
|
|
|
# Clone github repo
|
2020-09-22 23:10:16 +01:00
|
|
|
echo "Cloning simple-vpn"
|
2020-09-23 20:22:00 +01:00
|
|
|
git clone https://codehub.onpointcoding.net/sean/simple-vpn.git
|
2020-09-22 23:10:16 +01:00
|
|
|
cd simple-vpn
|
2020-09-23 20:22:00 +01:00
|
|
|
|
|
|
|
# Build and copy binary to bin directory
|
2020-09-22 23:10:16 +01:00
|
|
|
echo "Installing simple-vpn"
|
|
|
|
go build
|
|
|
|
sudo cp ./simple-vpn /usr/bin/ -i
|
|
|
|
cd ..
|
2020-09-23 20:22:00 +01:00
|
|
|
|
|
|
|
# Remove repository
|
2020-09-22 23:10:16 +01:00
|
|
|
echo "Cleaning up"
|
|
|
|
rm simple-vpn -rf
|
|
|
|
echo "Components installed..."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Please install golang before continuing"
|
|
|
|
exit
|
|
|
|
fi
|