usr_sbin/grml-iptstate: Fix a couple of shellcheck warnings
[grml-scripts.git] / usr_sbin / grml-iptstate
1 #!/bin/sh
2 # Filename:      grml-iptstate
3 # Purpose:       wrapper around iptstate (top-like display of IP Tables state table entries)
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 # shellcheck disable=SC1091
10 . /etc/grml/script-functions
11 # shellcheck disable=SC1091
12 . /etc/grml/lsb-functions
13 check4progs iptstate || exit 1
14
15 if grep -q '_conntrack' /proc/modules ; then
16    iptstate
17 else
18    einfo "iptstate is a top-like display of IP Tables state table entries."
19    echo
20    ewarn "Module ip_conntrack is not present. Can not start iptstate therefore."
21    eindent
22      einfon "Do you want to load it and invoke iptstate afterwards? [YES|no] "
23      read -r a
24      a=$(echo "$a" | tr '[:upper:]' '[:lower:]')
25      if [ "$a" = "yes" ] || [ "$a" = "y" ] || [ "$a" = "" ] ; then
26         modprobe ip_conntrack ; RC=$?
27         eend $RC
28         [ "$RC" = 0 ] && exec iptstate
29      else
30         echo "Aborting as requested."
31         exit 1
32      fi
33 fi
34
35 ## END OF FILE #################################################################