Add checkOS ()
This commit is contained in:
parent
931e82f5de
commit
243de3a4c4
1 changed files with 47 additions and 45 deletions
|
|
@ -21,6 +21,52 @@ function tunAvailable () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
IPTABLES='/etc/iptables/iptables.rules'
|
||||||
|
if [[ "$VERSION_ID" != 'VERSION_ID="8"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="9"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="16.04"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="17.10"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="18.04"' ]]; then
|
||||||
|
echo "Your version of Debian/Ubuntu is not supported."
|
||||||
|
echo "I can't install a recent version of OpenVPN on your system."
|
||||||
|
echo ""
|
||||||
|
echo "However, if you're using Debian unstable/testing, or Ubuntu beta,"
|
||||||
|
echo "then you can continue, a recent version of OpenVPN is available on these."
|
||||||
|
echo "Keep in mind they are not supported, though."
|
||||||
|
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
||||||
|
read -rp "Continue? [y/n]: " -e CONTINUE
|
||||||
|
done
|
||||||
|
if [[ "$CONTINUE" = "n" ]]; then
|
||||||
|
echo "Ok, bye!"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [[ -e /etc/fedora-release ]]; then
|
||||||
|
OS=fedora
|
||||||
|
IPTABLES='/etc/iptables/iptables.rules'
|
||||||
|
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."
|
||||||
|
echo ""
|
||||||
|
unset CONTINUE
|
||||||
|
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
||||||
|
read -rp "Continue anyway? [y/n]: " -e CONTINUE
|
||||||
|
done
|
||||||
|
if [[ "$CONTINUE" = "n" ]]; then
|
||||||
|
echo "Ok, bye!"
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
OS=centos
|
||||||
|
IPTABLES='/etc/iptables/iptables.rules'
|
||||||
|
else
|
||||||
|
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora or CentOS system"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function initialCheck () {
|
function initialCheck () {
|
||||||
if ! isRoot; then
|
if ! isRoot; then
|
||||||
echo "Sorry, you need to run this as root"
|
echo "Sorry, you need to run this as root"
|
||||||
|
|
@ -29,57 +75,13 @@ function initialCheck () {
|
||||||
echo "TUN is not available"
|
echo "TUN is not available"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
checkOS
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
|
|
||||||
initialCheck
|
initialCheck
|
||||||
|
|
||||||
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)
|
|
||||||
IPTABLES='/etc/iptables/iptables.rules'
|
|
||||||
if [[ "$VERSION_ID" != 'VERSION_ID="8"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="9"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="16.04"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="17.10"' ]] && [[ "$VERSION_ID" != 'VERSION_ID="18.04"' ]]; then
|
|
||||||
echo "Your version of Debian/Ubuntu is not supported."
|
|
||||||
echo "I can't install a recent version of OpenVPN on your system."
|
|
||||||
echo ""
|
|
||||||
echo "However, if you're using Debian unstable/testing, or Ubuntu beta,"
|
|
||||||
echo "then you can continue, a recent version of OpenVPN is available on these."
|
|
||||||
echo "Keep in mind they are not supported, though."
|
|
||||||
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
|
||||||
read -rp "Continue? [y/n]: " -e CONTINUE
|
|
||||||
done
|
|
||||||
if [[ "$CONTINUE" = "n" ]]; then
|
|
||||||
echo "Ok, bye!"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
elif [[ -e /etc/fedora-release ]]; then
|
|
||||||
OS=fedora
|
|
||||||
IPTABLES='/etc/iptables/iptables.rules'
|
|
||||||
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."
|
|
||||||
echo ""
|
|
||||||
unset CONTINUE
|
|
||||||
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
|
||||||
read -rp "Continue anyway? [y/n]: " -e CONTINUE
|
|
||||||
done
|
|
||||||
if [[ "$CONTINUE" = "n" ]]; then
|
|
||||||
echo "Ok, bye!"
|
|
||||||
exit 5
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
OS=centos
|
|
||||||
IPTABLES='/etc/iptables/iptables.rules'
|
|
||||||
else
|
|
||||||
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora or CentOS system"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
function newclient () {
|
function newclient () {
|
||||||
echo ""
|
echo ""
|
||||||
echo "Do you want to protect the configuration file with a password?"
|
echo "Do you want to protect the configuration file with a password?"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue