From e071610a37bbb487c7468dfdc4b183f3c2fef10c Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Sat, 22 May 2021 23:12:09 +0200 Subject: [PATCH] check for commands --- minifirewall | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/minifirewall b/minifirewall index f579a6e..fc027c0 100755 --- a/minifirewall +++ b/minifirewall @@ -38,8 +38,16 @@ set -u ######################### # iptables paths -IPT=/sbin/iptables -IPT6=/sbin/ip6tables +IPT=$(command -v iptables) +if [ -z "${IPT}" ]; then + echo "Unable to find 'iptables\` command in PATH." >&2 + exit 1 +fi +IPT6=$(command -v ip6tables) +if [ -z "${IPT6}" ]; then + echo "Unable to find 'ip6tables\` command in PATH." >&2 + exit 1 +fi # TCP/IP variables LOOPBACK='127.0.0.0/8'