Skip to content

Commit 0660752

Browse files
committed
Update OS support
- Remove support for Ubuntu 18.04 and Debian 10. For Debian 10, the "buster-backports" repository is no longer available.
1 parent a43b604 commit 0660752

File tree

1 file changed

+7
-44
lines changed

1 file changed

+7
-44
lines changed

wireguard-install.sh

+7-44
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ Supported distros are Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS, Fedora and
4444
}
4545

4646
check_os_ver() {
47-
if [[ "$os" == "ubuntu" && "$os_version" -lt 1804 ]]; then
48-
exiterr "Ubuntu 18.04 or higher is required to use this installer.
47+
if [[ "$os" == "ubuntu" && "$os_version" -lt 2004 ]]; then
48+
exiterr "Ubuntu 20.04 or higher is required to use this installer.
4949
This version of Ubuntu is too old and unsupported."
5050
fi
5151

52-
if [[ "$os" == "debian" && "$os_version" -lt 10 ]]; then
53-
exiterr "Debian 10 or higher is required to use this installer.
52+
if [[ "$os" == "debian" && "$os_version" -lt 11 ]]; then
53+
exiterr "Debian 11 or higher is required to use this installer.
5454
This version of Debian is too old and unsupported."
5555
fi
5656

@@ -646,37 +646,13 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
646646
apt-get -yqq update || apt-get -yqq update
647647
apt-get -yqq install wireguard qrencode $firewall >/dev/null
648648
) || exiterr2
649-
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
649+
elif [[ "$os" == "debian" ]]; then
650650
export DEBIAN_FRONTEND=noninteractive
651651
(
652652
set -x
653653
apt-get -yqq update || apt-get -yqq update
654654
apt-get -yqq install wireguard qrencode $firewall >/dev/null
655655
) || exiterr2
656-
elif [[ "$os" == "debian" && "$os_version" -eq 10 ]]; then
657-
if ! grep -qs '^deb .* buster-backports main' /etc/apt/sources.list /etc/apt/sources.list.d/*.list; then
658-
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
659-
fi
660-
export DEBIAN_FRONTEND=noninteractive
661-
(
662-
set -x
663-
apt-get -yqq update || apt-get -yqq update
664-
# Try to install kernel headers for the running kernel and avoid a reboot. This
665-
# can fail, so it's important to run separately from the other apt-get command.
666-
apt-get -yqq install linux-headers-"$(uname -r)" >/dev/null
667-
)
668-
# There are cleaner ways to find out the $architecture, but we require an
669-
# specific format for the package name and this approach provides what we need.
670-
architecture=$(dpkg --get-selections 'linux-image-*-*' | cut -f 1 | grep -oE '[^-]*$' -m 1)
671-
# linux-headers-$architecture points to the latest headers. We install it
672-
# because if the system has an outdated kernel, there is no guarantee that old
673-
# headers were still downloadable and to provide suitable headers for future
674-
# kernel updates.
675-
(
676-
set -x
677-
apt-get -yqq install linux-headers-"$architecture" >/dev/null
678-
apt-get -yqq install wireguard qrencode $firewall >/dev/null
679-
) || exiterr2
680656
elif [[ "$os" == "centos" && "$os_version" -eq 9 ]]; then
681657
(
682658
set -x
@@ -803,17 +779,10 @@ WantedBy=multi-user.target" >> /etc/systemd/system/wg-iptables.service
803779
echo -e '\xE2\x86\x91 That is a QR code containing the client configuration.'
804780
echo
805781
# If the kernel module didn't load, system probably had an outdated kernel
806-
# We'll try to help, but will not force a kernel upgrade upon the user
807782
if ! modprobe -nq wireguard; then
808783
echo "Warning!"
809784
echo "Installation was finished, but the WireGuard kernel module could not load."
810-
if [[ "$os" == "ubuntu" && "$os_version" -eq 1804 ]]; then
811-
echo 'Upgrade the kernel and headers with "apt-get install linux-generic" and restart.'
812-
elif [[ "$os" == "debian" && "$os_version" -eq 10 ]]; then
813-
echo "Upgrade the kernel with \"apt-get install linux-image-$architecture\" and restart."
814-
elif [[ "$os" == "centos" && "$os_version" -le 8 ]]; then
815-
echo "Reboot the system to load the most recent kernel."
816-
fi
785+
echo "Reboot the system to load the most recent kernel."
817786
else
818787
echo "Finished!"
819788
fi
@@ -1005,18 +974,12 @@ else
1005974
rm -rf /etc/wireguard/
1006975
apt-get remove --purge -y wireguard wireguard-tools >/dev/null
1007976
)
1008-
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
977+
elif [[ "$os" == "debian" ]]; then
1009978
(
1010979
set -x
1011980
rm -rf /etc/wireguard/
1012981
apt-get remove --purge -y wireguard wireguard-tools >/dev/null
1013982
)
1014-
elif [[ "$os" == "debian" && "$os_version" -eq 10 ]]; then
1015-
(
1016-
set -x
1017-
rm -rf /etc/wireguard/
1018-
apt-get remove --purge -y wireguard wireguard-dkms wireguard-tools >/dev/null
1019-
)
1020983
elif [[ "$os" == "centos" && "$os_version" -eq 9 ]]; then
1021984
(
1022985
set -x

0 commit comments

Comments
 (0)