[GH-ISSUE #32] sh script to universal installation to Ubuntu >= 22 and Debian >= 11 #15

Open
opened 2026-10-13 21:05:11 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @GubernievS on GitHub (Oct 6, 2024).
Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/32

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
Originally created by @GubernievS on GitHub (Oct 6, 2024). Original GitHub issue: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/issues/32 ``` 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 in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#15
No description provided.