1
0
mirror of https://github.com/Nyr/openvpn-install.git synced 2024-11-23 21:46:08 +03:00

Use different exit codes on error

This commit is contained in:
ValdikSS 2015-11-15 13:34:34 +03:00
parent d32416561b
commit 0265fc0e06

View File

@ -10,19 +10,19 @@
if [[ "$USER" != 'root' ]]; then if [[ "$USER" != 'root' ]]; then
echo "Sorry, you need to run this as root" echo "Sorry, you need to run this as root"
exit exit 1
fi fi
if [[ ! -e /dev/net/tun ]]; then if [[ ! -e /dev/net/tun ]]; then
echo "TUN/TAP is not available" echo "TUN/TAP is not available"
exit exit 2
fi fi
if grep -qs "CentOS release 5" "/etc/redhat-release"; then if grep -qs "CentOS release 5" "/etc/redhat-release"; then
echo "CentOS 5 is too old and not supported" echo "CentOS 5 is too old and not supported"
exit exit 3
fi fi
if [[ -e /etc/debian_version ]]; then if [[ -e /etc/debian_version ]]; then
@ -35,7 +35,7 @@ elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then
chmod +x /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local
else else
echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system" echo "Looks like you aren't running this installer on a Debian, Ubuntu or CentOS system"
exit exit 4
fi fi
newclient () { newclient () {
@ -95,7 +95,7 @@ if [[ -e /etc/openvpn/server.conf ]]; then
if [[ "$NUMBEROFCLIENTS" = '0' ]]; then if [[ "$NUMBEROFCLIENTS" = '0' ]]; then
echo "" echo ""
echo "You have no existing clients!" echo "You have no existing clients!"
exit exit 5
fi fi
echo "" echo ""
echo "Select the existing client certificate you want to revoke" echo "Select the existing client certificate you want to revoke"