melonvpn-original-cs/install-dependencies

45 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2020-09-22 23:10:16 +01:00
#!/bin/bash
# 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"
shouldbuild="neigh"
# 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"
echo "Run this script with force as a first argument to force a re-install"
2020-09-22 23:10:16 +01:00
else
shouldbuild="ye"
fi
# Look for an argument to force simple vpn re-install
if [ "$1" = "force" ]; then
shouldbuild="ye"
echo "Install enforced!"
fi
if [ "$shouldbuild" = "ye" ]; then
# Check for git repo existence if forcing re-install and delete if it does
if [ -d simple-vpn ]; then
echo "Found previous simple-vpn git download in working directory:"
echo "Deleting!"
rm -f -R simple-vpn
fi
# Clone github repo
2020-09-22 23:10:16 +01:00
echo "Cloning simple-vpn"
git clone https://codehub.onpointcoding.net/sean/simple-vpn.git
2020-09-22 23:10:16 +01:00
cd simple-vpn
# 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/
2020-09-22 23:10:16 +01:00
cd ..
# 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