aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislas Lange <git@slange.me>2023-01-22 12:02:44 +0100
committerStanislas Lange <git@slange.me>2023-01-22 12:02:44 +0100
commit5b483ecb8913e48bd670bfea43e5664a8ebce199 (patch)
treecd5334333bf52c9c55e0c34b2ae59598212ffdfd
parent258eb9441b81f4bb35922fa6cf43fbbf3cf2241e (diff)
Fix support for CentOS, Rocky and AlmaLinux
Fix https://github.com/angristan/wireguard-install/pull/253 Fix https://github.com/angristan/wireguard-install/issues/374 Fix https://github.com/angristan/wireguard-install/issues/231
-rw-r--r--README.md11
-rw-r--r--wireguard-install.sh59
2 files changed, 33 insertions, 37 deletions
diff --git a/README.md b/README.md
index 7560004..86b02e9 100644
--- a/README.md
+++ b/README.md
@@ -17,13 +17,14 @@ WireGuard does not fit your environment? Check out [openvpn-install](https://git
Supported distributions:
-- Ubuntu >= 16.04
-- Debian >= 10
-- Fedora
-- CentOS
-- AlmaLinux
+- AlmaLinux >= 8
- Arch Linux
+- CentOS Stream >= 8
+- Debian >= 10
+- Fedora >= 32
- Oracle Linux
+- Rocky Linux >= 8
+- Ubuntu >= 18.04
## Usage
diff --git a/wireguard-install.sh b/wireguard-install.sh
index 4eb08b5..1be20cd 100644
--- a/wireguard-install.sh
+++ b/wireguard-install.sh
@@ -31,26 +31,24 @@ function checkVirt() {
}
function checkOS() {
- # Check OS version
- if [[ -e /etc/debian_version ]]; then
- source /etc/os-release
- OS="${ID}" # debian or ubuntu
- if [[ ${ID} == "debian" || ${ID} == "raspbian" ]]; then
- if [[ ${VERSION_ID} -lt 10 ]]; then
- echo "Your version of Debian (${VERSION_ID}) is not supported. Please use Debian 10 Buster or later"
- exit 1
- fi
- OS=debian # overwrite if raspbian
+ source /etc/os-release
+ OS="${ID}"
+ if [[ ${OS} == "debian" || ${OS} == "raspbian" ]]; then
+ if [[ ${VERSION_ID} -lt 10 ]]; then
+ echo "Your version of Debian (${VERSION_ID}) is not supported. Please use Debian 10 Buster or later"
+ exit 1
+ fi
+ OS=debian # overwrite if raspbian
+ elif [[ ${OS} == "fedora" ]]; then
+ if [[ ${VERSION_ID} -lt 32 ]]; then
+ echo "Your version of Fedora (${VERSION_ID}) is not supported. Please use Fedora 32 or later"
+ exit 1
+ fi
+ elif [[ ${OS} == 'centos' ]] || [[ ${OS} == 'almalinux' ]] || [[ ${OS} == 'rocky' ]]; then
+ if [[ ${VERSION_ID} == 7* ]]; then
+ echo "Your version of CentOS (${VERSION_ID}) is not supported. Please use CentOS 8 or later"
+ exit 1
fi
- elif [[ -e /etc/almalinux-release ]]; then
- source /etc/os-release
- OS=almalinux
- elif [[ -e /etc/fedora-release ]]; then
- source /etc/os-release
- OS="${ID}"
- elif [[ -e /etc/centos-release ]]; then
- source /etc/os-release
- OS=centos
elif [[ -e /etc/oracle-release ]]; then
source /etc/os-release
OS=oracle
@@ -176,18 +174,13 @@ function installWireGuard() {
dnf install -y wireguard-dkms
fi
dnf install -y wireguard-tools iptables qrencode
- elif [[ ${OS} == 'almalinux' ]]; then
- dnf -y install epel-release elrepo-release
- dnf -y install wireguard-tools iptables qrencode
+ elif [[ ${OS} == 'centos' ]] || [[ ${OS} == 'almalinux' ]] || [[ ${OS} == 'rocky' ]]; then
if [[ ${VERSION_ID} == 8* ]]; then
- dnf -y install kmod-wireguard
+ yum install -y epel-release elrepo-release
+ yum install -y kmod-wireguard
+ yum install -y qrencode # not available on release 9
fi
- elif [[ ${OS} == 'centos' ]]; then
- yum -y install epel-release elrepo-release
- if [[ ${VERSION_ID} -eq 7 ]]; then
- yum -y install yum-plugin-elrepo
- fi
- yum -y install kmod-wireguard wireguard-tools iptables qrencode
+ yum install -y wireguard-tools iptables
elif [[ ${OS} == 'oracle' ]]; then
dnf install -y oraclelinux-developer-release-el8
dnf config-manager --disable -y ol8_developer
@@ -354,9 +347,11 @@ AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"/etc/wireguard/${SER
wg syncconf "${SERVER_WG_NIC}" <(wg-quick strip "${SERVER_WG_NIC}")
- echo -e "\nHere is your client config file as a QR Code:"
-
- qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
+ # Generate QR code if qrencode is installed
+ if command -v qrencode &>/dev/null; then
+ echo -e "\nHere is your client config file as a QR Code:"
+ qrencode -t ansiutf8 -l L <"${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
+ fi
echo "It is also available in ${HOME_DIR}/${SERVER_WG_NIC}-client-${CLIENT_NAME}.conf"
}