Created
November 14, 2023 09:59
-
-
Save zoonderkins/d1071f8f15336aac7b76f152d6f23e41 to your computer and use it in GitHub Desktop.
one click install dnsproxy
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 | |
# Function to download file | |
download_file() { | |
url=$1 | |
file_name=$2 | |
if command -v wget > /dev/null; then | |
wget "$url" -O "$file_name" | |
elif command -v curl > /dev/null; then | |
curl -L "$url" -o "$file_name" | |
else | |
echo "Error: wget or curl is required to download the file." | |
exit 1 | |
fi | |
} | |
# Fetch the latest release data from GitHub | |
latest_release=$(curl -s https://api.github.com/repos/AdguardTeam/dnsproxy/releases/latest) | |
# Extract the tag name (version) from the release data | |
version=$(echo $latest_release | grep -Po '"tag_name": "\K.*?(?=")') | |
# Construct the download URL | |
url="https://github.com/AdguardTeam/dnsproxy/releases/download/$version/dnsproxy-linux-amd64-$version.tar.gz" | |
# Download the file | |
download_file "$url" "dnsproxy-linux-amd64-$version.tar.gz" | |
# Extract the downloaded file | |
tar xvf "dnsproxy-linux-amd64-$version.tar.gz" | |
# Move the dnsproxy binary to /usr/bin | |
mv linux-amd64/dnsproxy /usr/bin | |
# Restart the dnsproxy service | |
service dnsproxy restart | |
# service dnsproxy-server restart | |
# Remove the extracted directory and tar.gz file | |
rm -rf linux-amd64 | |
rm "dnsproxy-linux-amd64-$version.tar.gz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment