Last active
November 21, 2016 22:30
-
-
Save aki237/7d4443e590c6ff390f8226be34f83bfc to your computer and use it in GitHub Desktop.
Install proGY using an automated script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
progyinstaller() | |
{ | |
if [ "$(id -u)" == "0" ]; then | |
echo "Please don't run this script as root" | |
exit | |
fi | |
echo "Installing proGY..." | |
echo "Installing Binary from github releases" | |
if [ ! -d "/tmp/proGY-setup" ]; then | |
mkdir /tmp/proGY-setup -p | |
fi | |
echo "Downloading proGY Release" | |
curl -L -# "https://github.com/aki237/proGY/releases/download/2.0.1/proGY" > /tmp/proGY-setup/proGY | |
chmod +x /tmp/proGY-setup/proGY | |
if [ ! -f "/tmp/proGY-setup/proGY" ]; then | |
echo "Some Error in trying to access the proGY binary from github. Try again later." | |
exit | |
fi | |
sudo cp /tmp/proGY-setup/proGY /usr/bin/ | |
echo "Done installing binary" | |
echo "Downloading systemd service file for proGY" | |
curl -# -L "https://raw.githubusercontent.com/aki237/proGY/master/proGY.service" > /tmp/proGY-setup/proGY.service | |
if [ ! -f "/tmp/proGY-setup/proGY.service" ]; then | |
echo "Some Error in trying to access the proGY service file from github. Try again later." | |
exit | |
fi | |
if [ ! -d "/usr/lib/systemd/system/" ]; then | |
sudo mkdir -p /usr/lib/systemd/system/ | |
fi | |
cat /tmp/proGY-setup/proGY.service | sed "s/\[USER\]/$USER/g" > /tmp/proGY-setup/new.service | |
mv /tmp/proGY-setup/new.service /tmp/proGY-setup/proGY.service | |
sudo cp /tmp/proGY-setup/proGY.service /usr/lib/systemd/system/ | |
echo "Done installing service file" | |
echo -n "Do you want to run proGY after every bootup? (y/n) :" | |
read enable | |
if [ $enable == "y" ]; then | |
sudo systemctl enable proGY.service | |
fi | |
listenAddress=":9999" | |
echo -n "Where to listen ? : " | |
read listenAddressp | |
if [[ "$listenAddressp" == "" ]]; then | |
echo "Setting listenAddress to 127.0.0.1:9999" | |
else | |
listenAddress=$listenAddressp | |
fi | |
echo -n "Proxy Server ? : " | |
read proxyAddress | |
echo -n "Credentials.Username : " | |
read username | |
echo -n "Credentials.Password : " | |
read -s password | |
verbose="true" | |
echo -ne "\nverbose output ? (y/n) : " | |
read verbose | |
if [ "$verbose" == "y" ]; then | |
verbose="true" | |
fi | |
cat > $HOME/.progy-new <<EOF | |
{ | |
"listenaddress":"$listenAddress", | |
"remoteproxyaddress":"$proxyAddress", | |
"Creds":[ | |
{ | |
"username":"$username", | |
"password":"$password" | |
} | |
], | |
"verbose":$verbose | |
} | |
EOF | |
sudo systemctl start proGY.service | |
} | |
progyinstaller |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment