Add support for AlmaLinux and Rocky Linux

An unrelated fix to avoid one harmless warning during removal is also included.
This commit is contained in:
Nyr 2021-09-03 17:31:07 +02:00
parent 9210290c19
commit b0ccd4d0bc

View File

@ -28,15 +28,15 @@ if grep -qs "ubuntu" /etc/os-release; then
elif [[ -e /etc/debian_version ]]; then
os="debian"
os_version=$(grep -oE '[0-9]+' /etc/debian_version | head -1)
elif [[ -e /etc/centos-release ]]; then
elif [[ -e /etc/almalinux-release || -e /etc/rocky-release || -e /etc/centos-release ]]; then
os="centos"
os_version=$(grep -oE '[0-9]+' /etc/centos-release | head -1)
os_version=$(grep -shoE '[0-9]+' /etc/almalinux-release /etc/rocky-release /etc/centos-release | head -1)
elif [[ -e /etc/fedora-release ]]; then
os="fedora"
os_version=$(grep -oE '[0-9]+' /etc/fedora-release | head -1)
else
echo "This installer seems to be running on an unsupported distribution.
Supported distributions are Ubuntu, Debian, CentOS, and Fedora."
Supported distros are Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora."
exit
fi
@ -636,16 +636,16 @@ else
apt-get remove --purge -y wireguard wireguard-dkms wireguard-tools
elif [[ "$os" == "centos" && "$os_version" -eq 8 ]]; then
# CentOS 8
rm -rf /etc/wireguard/
dnf remove -y kmod-wireguard wireguard-tools
rm -rf /etc/wireguard/
elif [[ "$os" == "centos" && "$os_version" -eq 7 ]]; then
# CentOS 7
rm -rf /etc/wireguard/
yum remove -y kmod-wireguard wireguard-tools
rm -rf /etc/wireguard/
elif [[ "$os" == "fedora" ]]; then
# Fedora
rm -rf /etc/wireguard/
dnf remove -y wireguard-tools
rm -rf /etc/wireguard/
fi
else
{ crontab -l 2>/dev/null | grep -v '/usr/local/sbin/boringtun-upgrade' ; } | crontab -
@ -663,16 +663,16 @@ else
apt-get remove --purge -y wireguard-tools
elif [[ "$os" == "centos" && "$os_version" -eq 8 ]]; then
# CentOS 8
rm -rf /etc/wireguard/
dnf remove -y wireguard-tools
rm -rf /etc/wireguard/
elif [[ "$os" == "centos" && "$os_version" -eq 7 ]]; then
# CentOS 7
rm -rf /etc/wireguard/
yum remove -y wireguard-tools
rm -rf /etc/wireguard/
elif [[ "$os" == "fedora" ]]; then
# Fedora
rm -rf /etc/wireguard/
dnf remove -y wireguard-tools
rm -rf /etc/wireguard/
fi
rm -f /usr/local/sbin/boringtun /usr/local/sbin/boringtun-upgrade
fi