Use appropiate exit code when failing

Currently, we use the 0 status code, doesn't matter if it's a failure or not, so lets fix it.
This commit is contained in:
Eduard Tolosa 2023-04-29 18:25:19 -05:00
parent 144767ebb2
commit 2fdae488f9

View file

@ -9,7 +9,7 @@ case "$1" in
start)
if test -f "$RULES"; then
echo "$RULES exists. Either delete it, or stop tor-router first."
exit
exit 1
else
iptables-save >$RULES
# Executable file to create rules for transparent proxy
@ -24,18 +24,18 @@ case "$1" in
TOR_UID=$(id -u toranon)
else
echo "Unknown distro, please create report the issue to https://github.com/edu4rdshl/tor-router/issues"
exit
exit 1
fi
if ! command -v tor >/dev/null; then
echo "You need to install the tor package."
exit
exit 1
elif ! systemctl is-active tor.service >/dev/null; then
echo "The tor service is not active, please start the tor service before running the script."
exit
exit 1
elif ! command -v iptables >/dev/null; then
echo "You need to install the iptables package."
exit
exit 1
else
iptables -F
iptables -t nat -F
@ -76,4 +76,5 @@ case "$1" in
;;
*)
echo "Usage: $0 {start|stop|restart}"
;;
esac