packages: libs/savedynamic: rename package to firewall-mod-save and script to 20_save.sh (from savedynamic.sh). Thanks jow

git-svn-id: svn://svn.openwrt.org/openwrt/packages@21371 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
cshore 2010-05-05 08:52:10 +00:00
parent b3e02856ab
commit 810e7c4bf1
2 changed files with 18 additions and 18 deletions

View File

@ -8,28 +8,27 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=savedynamic PKG_NAME:=firewall-mod-save
PKG_VERSION:=1.0 PKG_VERSION:=1.0
PKG_RELEASE:=1 PKG_RELEASE:=2
MAINTAINER:=Daniel Dickinson <cshore@csolve.net> MAINTAINER:=Daniel Dickinson <cshore@csolve.net>
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
define Package/savedynamic/Default define Package/firewall-mod-save/Default
SECTION:=libs SECTION:=libs
CATEGORY:=Libraries CATEGORY:=Libraries
TITLE:=Preserve dynamic chains during firewall restart TITLE:=Preserve dynamic chains during firewall restart
endef endef
define Package/savedynamic define Package/firewall-mod-save
$(call Package/savedynamic/Default) $(call Package/firewall-mod-save/Default)
MENU:=1
DEPENDS:=+iptables-utils DEPENDS:=+iptables-utils
endef endef
define Package/savedynamic/description define Package/firewall-mod-save/description
Uses iptables-save to save the option chain in option table (default filter) Uses iptables-save to save the option chain in option table (default filter)
as defined by the config section save in /etc/config/firewall. as defined by the config section save in /etc/config/firewall.
endef endef
@ -43,10 +42,10 @@ endef
define Build/Compile define Build/Compile
endef endef
define Package/block-extroot/install define Package/firewall-mod-save/install
$(INSTALL_DIR) $(1)/lib/firewall $(INSTALL_DIR) $(1)/lib/firewall
$(INSTALL_DATA) ./files/savedynamic.sh $(1)/lib/firewall/ $(INSTALL_DATA) ./files/20_save.sh $(1)/lib/firewall/
endef endef
$(eval $(call BuildPackage,savedynamic)) $(eval $(call BuildPackage,firewall-mod-save))

View File

@ -2,7 +2,7 @@
. /etc/functions.sh . /etc/functions.sh
savedynamic_print_table_chain() { save_print_table_chain() {
local table="$1" local table="$1"
local chain="$2" local chain="$2"
local fsave="$3" local fsave="$3"
@ -28,7 +28,7 @@ savedynamic_print_table_chain() {
rm -f "$fsavetmp" rm -f "$fsavetmp"
} }
savedynamic_save_fw_chain() { save_save_fw_chain() {
local chain local chain
local table local table
local fsave="/tmp/.firewall/save" local fsave="/tmp/.firewall/save"
@ -38,11 +38,11 @@ savedynamic_save_fw_chain() {
[ -z "$chain" ] && return 0 [ -z "$chain" ] && return 0
mkdir -p /tmp/.firewall mkdir -p /tmp/.firewall
iptables-save >"$fsave" iptables-save >"$fsave"
savedynamic_print_table_chain $table $chain "$fsave" > /tmp/.firewall/save-$table-$chain save_print_table_chain $table $chain "$fsave" > /tmp/.firewall/save-$table-$chain
} }
savedynamic_load_fw_chain() { save_load_fw_chain() {
local chain local chain
local table local table
@ -57,16 +57,17 @@ savedynamic_load_fw_chain() {
} }
} }
savedynamic_pre_stop_cb() { save_pre_stop_cb() {
echo "Saving dynamic firewall chains" echo "Saving dynamic firewall chains"
config_load firewall config_load firewall
config_foreach savedynamic_save_fw_chain save config_foreach save_save_fw_chain save
} }
savedynamic_post_core_cb() { save_post_core_cb() {
echo "Loading dynamic firewall chains" echo "Loading dynamic firewall chains"
config_load firewall config_load firewall
config_foreach savedynamic_load_fw_chain save config_foreach save_load_fw_chain save
} }