浏览代码

Corrected: status detection and dir execution

Laurent HUBERT 9 月之前
父节点
当前提交
2899673dfb
共有 3 个文件被更改,包括 13 次插入3 次删除
  1. 3 1
      scripts/execute_lfirewall_dir
  2. 2 0
      scripts/lfirewall
  3. 8 2
      scripts/setup

+ 3 - 1
scripts/execute_lfirewall_dir

@@ -15,7 +15,7 @@ eval set -- "$options"
 set -eu
 
 firewall_action=no
-verbose=0
+#verbose=0
 
 while :
 do
@@ -46,6 +46,8 @@ done
 export do_action=${1:-}
 script_dir=${2:-}
 
+shift 2 # clean any arguments
+
 if [ -z "${do_action}" ] ; then
     echo "ERROR: missing action" >&2
     exit 2

+ 2 - 0
scripts/lfirewall

@@ -164,6 +164,8 @@ fi
 
 do_log=do_not_log_action
 
+export verbose
+
 ##########################
 # Drops INPUT
 ##########################

+ 8 - 2
scripts/setup

@@ -150,6 +150,9 @@ do_exec () {
 
 
 do_check () {
+    if [ ${verbose} -ge 1 ] ; then
+        echo "do_check params='$*'"
+    fi
     local it_action=`get_action_information $*`
     local it_table=`get_table_information $*`
     local it_command=`get_command_information $*`
@@ -170,11 +173,14 @@ do_check () {
 	esac
 	default_option=-C
 	if [ ${verbose} -ge 1 ] ; then
+		echo "it_action=$it_action"
+		echo "it_table=$it_table"
+		echo "it_command=$it_command"
 		echo $do_log "$it_action:" $IP_TABLES $it_table -C $it_command
 		echo $IP_TABLES $it_table -C $it_command
 	fi
-	$do_log "$it_action:" $IP_TABLES -C $it_command
-	$IP_TABLES  $it_table -C $it_command
+	$do_log "$it_action:" $IP_TABLES $it_table -C $it_command
+	$IP_TABLES $it_table -C $it_command
 	global_status=$((global_status+$?))
 }