Feat: support Linux Mint

This commit is contained in:
Miroslav Valcicak 2022-05-27 20:57:29 +02:00
parent cf06d39805
commit 95615a293c
2 changed files with 33 additions and 5 deletions

View file

@ -1,5 +1,5 @@
## wireguard-install
WireGuard [road warrior](http://en.wikipedia.org/wiki/Road_warrior_%28computing%29) installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora.
WireGuard [road warrior](http://en.wikipedia.org/wiki/Road_warrior_%28computing%29) installer for Ubuntu, Linux Mint, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora.
This script will let you set up your own VPN server in no more than a minute, even if you haven't used WireGuard before. It has been designed to be as unobtrusive and universal as possible.

View file

@ -22,7 +22,10 @@ fi
# Detect OS
# $os_version variables aren't always in use, but are kept here for convenience
if grep -qs "ubuntu" /etc/os-release; then
if [[ -e /etc/linuxmint/info ]]; then
os="linuxmint"
os_version=$(grep 'RELEASE=' /etc/linuxmint/info | cut -d '=' -f 2 | cut -d '.' -f 1)
elif grep -qs "ubuntu" /etc/os-release; then
os="ubuntu"
os_version=$(grep 'VERSION_ID' /etc/os-release | cut -d '"' -f 2 | tr -d '.')
elif [[ -e /etc/debian_version ]]; then
@ -36,7 +39,13 @@ elif [[ -e /etc/fedora-release ]]; then
os_version=$(grep -oE '[0-9]+' /etc/fedora-release | head -1)
else
echo "This installer seems to be running on an unsupported distribution.
Supported distros are Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora."
Supported distros are Ubuntu, Linux Mint, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora."
exit
fi
if [[ "$os" == "linuxmint" && "$os_version" -lt 19 ]]; then
echo "Linux Mint 19 or higher is required to use this installer.
This version of Linux Mint is too old and unsupported."
exit
fi
@ -262,7 +271,7 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
if [[ "$boringtun_updates" =~ ^[yY]$ ]]; then
if [[ "$os" == "centos" || "$os" == "fedora" ]]; then
cron="cronie"
elif [[ "$os" == "debian" || "$os" == "ubuntu" ]]; then
elif [[ "$os" == "debian" || "$os" == "ubuntu" || "$os" == "linuxmint" ]]; then
cron="cron"
fi
fi
@ -276,7 +285,7 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
# We don't want to silently enable firewalld, so we give a subtle warning
# If the user continues, firewalld will be installed and enabled during setup
echo "firewalld, which is required to manage routing tables, will also be installed."
elif [[ "$os" == "debian" || "$os" == "ubuntu" ]]; then
elif [[ "$os" == "debian" || "$os" == "ubuntu" || "$os" == "linuxmint" ]]; then
# iptables is way less invasive than firewalld so no warning is given
firewall="iptables"
fi
@ -289,6 +298,10 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
# Ubuntu
apt-get update
apt-get install -y wireguard qrencode $firewall
elif [[ "$os" == "linuxmint" ]]; then
# Linux Mint
apt-get update
apt-get install -y wireguard qrencode $firewall
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
# Debian 11 or higher
apt-get update
@ -335,6 +348,11 @@ if [[ ! -e /etc/wireguard/wg0.conf ]]; then
apt-get update
apt-get install -y qrencode ca-certificates $cron $firewall
apt-get install -y wireguard-tools --no-install-recommends
elif [[ "$os" == "linuxmint" ]]; then
# Linux Mint
apt-get update
apt-get install -y qrencode ca-certificates $cron $firewall
apt-get install -y wireguard-tools --no-install-recommends
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
# Debian 11 or higher
apt-get update
@ -502,6 +520,8 @@ EOF
echo "Installation was finished, but the WireGuard kernel module could not load."
if [[ "$os" == "ubuntu" && "$os_version" -eq 1804 ]]; then
echo 'Upgrade the kernel and headers with "apt-get install linux-generic" and restart.'
elif [[ "$os" == "linuxmint" && "$os_version" -eq 19 ]]; then
echo 'Upgrade the kernel and headers with "apt-get install linux-generic" and restart.'
elif [[ "$os" == "debian" && "$os_version" -eq 10 ]]; then
echo "Upgrade the kernel with \"apt-get install linux-image-$architecture\" and restart."
elif [[ "$os" == "centos" && "$os_version" -le 8 ]]; then
@ -627,6 +647,10 @@ else
# Ubuntu
rm -rf /etc/wireguard/
apt-get remove --purge -y wireguard wireguard-tools
elif [[ "$os" == "linuxmint" ]]; then
# Linux Mint
rm -rf /etc/wireguard/
apt-get remove --purge -y wireguard wireguard-tools
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
# Debian 11 or higher
rm -rf /etc/wireguard/
@ -654,6 +678,10 @@ else
# Ubuntu
rm -rf /etc/wireguard/
apt-get remove --purge -y wireguard-tools
elif [[ "$os" == "linuxmint" ]]; then
# Linux Mint
rm -rf /etc/wireguard/
apt-get remove --purge -y wireguard-tools
elif [[ "$os" == "debian" && "$os_version" -ge 11 ]]; then
# Debian 11 or higher
rm -rf /etc/wireguard/