mirror of
https://github.com/angristan/wireguard-install.git
synced 2024-11-01 11:12:31 +00:00
Add checkOS()
This commit is contained in:
parent
cdfdf4d7a4
commit
09f0611023
@ -23,6 +23,24 @@ function checkVirt() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkOS() {
|
||||||
|
# Check OS version
|
||||||
|
if [[ -e /etc/debian_version ]]; then
|
||||||
|
source /etc/os-release
|
||||||
|
OS=$ID # debian or ubuntu
|
||||||
|
elif [[ -e /etc/fedora-release ]]; then
|
||||||
|
source /etc/os-release
|
||||||
|
OS=$ID
|
||||||
|
elif [[ -e /etc/centos-release ]]; then
|
||||||
|
OS=centos
|
||||||
|
elif [[ -e /etc/arch-release ]]; then
|
||||||
|
OS=arch
|
||||||
|
else
|
||||||
|
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS or Arch Linux system"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function addClient() {
|
function addClient() {
|
||||||
# Load params
|
# Load params
|
||||||
source /etc/wireguard/params
|
source /etc/wireguard/params
|
||||||
@ -99,22 +117,6 @@ elif [[ -e /etc/wireguard/params ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check OS version
|
|
||||||
if [[ -e /etc/debian_version ]]; then
|
|
||||||
source /etc/os-release
|
|
||||||
OS=$ID # debian or ubuntu
|
|
||||||
elif [[ -e /etc/fedora-release ]]; then
|
|
||||||
source /etc/os-release
|
|
||||||
OS=$ID
|
|
||||||
elif [[ -e /etc/centos-release ]]; then
|
|
||||||
OS=centos
|
|
||||||
elif [[ -e /etc/arch-release ]]; then
|
|
||||||
OS=arch
|
|
||||||
else
|
|
||||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS or Arch Linux system"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Detect public IPv4 address and pre-fill for the user
|
# Detect public IPv4 address and pre-fill for the user
|
||||||
SERVER_PUB_IPV4=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
|
SERVER_PUB_IPV4=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
|
||||||
read -rp "IPv4 or IPv6 public address: " -e -i "$SERVER_PUB_IPV4" SERVER_PUB_IP
|
read -rp "IPv4 or IPv6 public address: " -e -i "$SERVER_PUB_IPV4" SERVER_PUB_IP
|
||||||
|
Loading…
Reference in New Issue
Block a user