Add checkOS ()
This commit is contained in:
parent
931e82f5de
commit
243de3a4c4
1 changed files with 47 additions and 45 deletions
|
|
@ -21,21 +21,8 @@ function tunAvailable () {
|
|||
fi
|
||||
}
|
||||
|
||||
function initialCheck () {
|
||||
if ! isRoot; then
|
||||
echo "Sorry, you need to run this as root"
|
||||
exit 1
|
||||
elif ! tunAvailable; then
|
||||
echo "TUN is not available"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Main
|
||||
|
||||
initialCheck
|
||||
|
||||
if [[ -e /etc/debian_version ]]; then
|
||||
function checkOS() {
|
||||
if [[ -e /etc/debian_version ]]; then
|
||||
OS="debian"
|
||||
# Getting the version number, to verify that a recent version of OpenVPN is available
|
||||
VERSION_ID=$(grep "VERSION_ID" /etc/os-release)
|
||||
|
|
@ -55,10 +42,10 @@ if [[ -e /etc/debian_version ]]; then
|
|||
exit 4
|
||||
fi
|
||||
fi
|
||||
elif [[ -e /etc/fedora-release ]]; then
|
||||
elif [[ -e /etc/fedora-release ]]; then
|
||||
OS=fedora
|
||||
IPTABLES='/etc/iptables/iptables.rules'
|
||||
elif [[ -e /etc/centos-release ]]; then
|
||||
elif [[ -e /etc/centos-release ]]; then
|
||||
if ! grep -qs "^CentOS Linux release 7" /etc/centos-release; then
|
||||
echo "Your version of CentOS is not supported."
|
||||
echo "The script only support CentOS 7."
|
||||
|
|
@ -74,11 +61,26 @@ elif [[ -e /etc/centos-release ]]; then
|
|||
fi
|
||||
OS=centos
|
||||
IPTABLES='/etc/iptables/iptables.rules'
|
||||
else
|
||||
else
|
||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora or CentOS system"
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function initialCheck () {
|
||||
if ! isRoot; then
|
||||
echo "Sorry, you need to run this as root"
|
||||
exit 1
|
||||
elif ! tunAvailable; then
|
||||
echo "TUN is not available"
|
||||
exit 2
|
||||
fi
|
||||
checkOS
|
||||
}
|
||||
|
||||
# Main
|
||||
|
||||
initialCheck
|
||||
|
||||
function newclient () {
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue