Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sh script to universal installation to Ubuntu >= 22 and Debian >= 11 #32

Open
GubernievS opened this issue Oct 6, 2024 · 0 comments
Open

Comments

@GubernievS
Copy link

GubernievS commented Oct 6, 2024

set -e
OS=$(lsb_release -si | tr '[:upper:]' '[:lower:]')

apt update
apt install -y curl gnupg2

gpg --keyserver keyserver.ubuntu.com --recv-keys 75c9dd72c799870e310542e24166f2c257290828
gpg --export 75c9dd72c799870e310542e24166f2c257290828 | tee /usr/share/keyrings/amnezia.gpg > /dev/null

rm -f /etc/apt/sources.list.d/amnezia.list || true
rm -f /etc/apt/sources.list.d/amneziawg.sources || true
rm -f /etc/apt/sources.list.d/amneziawg.sources.list || true

if [[ $OS == "ubuntu" ]]; then
	echo "deb [signed-by=/usr/share/keyrings/amnezia.gpg] https://ppa.launchpadcontent.net/amnezia/ppa/ubuntu $(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/amnezia.list
	echo "deb-src [signed-by=/usr/share/keyrings/amnezia.gpg] https://ppa.launchpadcontent.net/amnezia/ppa/ubuntu $(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/amnezia.list
elif [[ $OS == "debian" ]]; then
	echo "deb [signed-by=/usr/share/keyrings/amnezia.gpg] https://ppa.launchpadcontent.net/amnezia/ppa/ubuntu focal main" | tee -a /etc/apt/sources.list.d/amnezia.list
	echo "deb-src [signed-by=/usr/share/keyrings/amnezia.gpg] https://ppa.launchpadcontent.net/amnezia/ppa/ubuntu focal main" | tee -a /etc/apt/sources.list.d/amnezia.list
fi

if [[ -e /etc/apt/sources.list.d/ubuntu.sources ]]; then
	if ! grep -qE '^[^#]*deb-src' /etc/apt/sources.list.d/ubuntu.sources; then
		cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/amneziawg.sources
		sed -i '/^$/d; /^#/d; s/deb/deb-src/' /etc/apt/sources.list.d/amneziawg.sources
	fi
elif [[ -e /etc/apt/sources.list ]]; then
	if ! grep -q "^deb-src" /etc/apt/sources.list; then
		cp /etc/apt/sources.list /etc/apt/sources.list.d/amneziawg.sources.list
		sed -i '/^$/d; /^#/d; s/^deb/deb-src/' /etc/apt/sources.list.d/amneziawg.sources.list
	fi
fi

apt update
apt install -y amneziawg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant