[package] shorewall-lite: add missing lsm script
authorFlorian Fainelli <florian@openwrt.org>
Sun, 20 Feb 2011 16:03:59 +0000 (16:03 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 20 Feb 2011 16:03:59 +0000 (16:03 +0000)
Per http://article.gmane.org/gmane.comp.embedded.openwrt.devel/7339
please find attached the referenced missing lsm_script.

Signed-off-by: Brian J. Murrell <brian <at> interlinx.bc.ca>
SVN-Revision: 25613

net/shorewall-lite/Makefile
net/shorewall-lite/files/lsm_script [new file with mode: 0644]

index 4e874ba..d902564 100644 (file)
@@ -1,5 +1,5 @@
 # 
-# Copyright (C) 2008 OpenWrt.org
+# Copyright (C) 2008-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=shorewall-lite
 PKG_VERSION:=4.4.12.2
 PKG_DIRECTORY:=4.4.12
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=http://www.shorewall.net/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
        http://www1.shorewall.net/pub/shorewall/4.4/shorewall-$(PKG_DIRECTORY)/ \
@@ -58,6 +58,7 @@ define Package/shorewall-lite/install
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/shorewall-lite $(1)/sbin
        $(CP) $(PKG_INSTALL_DIR)/usr/share/shorewall-lite $(1)/usr/share
        $(INSTALL_BIN) ./files/hostname $(1)/usr/share/shorewall-lite
+       $(INSTALL_BIN) ./files/lsm_script $(1)/etc/lsm/script.d/45_shorewall-lite
        $(CP) $(PKG_INSTALL_DIR)/etc/shorewall-lite $(1)/etc
        $(CP) ./files/vardir $(1)/etc/shorewall-lite
 endef
diff --git a/net/shorewall-lite/files/lsm_script b/net/shorewall-lite/files/lsm_script
new file mode 100644 (file)
index 0000000..f0ccb34
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+STATE=${1}
+NAME=${2}
+CHECKIP=${3}
+DEVICE=${4}
+WARN_EMAIL=${5}
+REPLIED=${6}
+WAITING=${7}
+TIMEOUT=${8}
+REPLY_LATE=${9}
+CONS_RCVD=${10}
+CONS_WAIT=${11}
+CONS_MISS=${12}
+AVG_RTT=${13}
+
+if [ -f /usr/share/shorewall-lite/lib.base ]; then
+    VARDIR=/var/lib/shorewall-lite
+    STATEDIR=/etc/shorewall-lite
+else
+    VARDIR=/var/lib/shorewall
+    STATEDIR=/etc/shorewall
+fi
+
+[ -f ${STATEDIR}/vardir ] && . ${STATEDIR}/vardir
+
+[ ${STATE} = up ] && state=0 || state=1
+
+echo $state > ${VARDIR}/${DEVICE}.status
+
+/sbin/shorewall-lite restart -f >> /var/log/lsm 2>&1
+
+/sbin/shorewall-lite show routing >> /var/log/lsm