mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-04 10:33:56 +08:00
update 2026-08-15 20:26:22
This commit is contained in:
1 parent
d5fe2d005a
commit
a459a74f19
32 files changed
+1991
-1606
No files matched your search
@@ -7,7 +7,7 @@ local uci = api.uci
|
||||
local jsonc = api.jsonc
|
||||
|
||||
local CONFIG = api.s_config
|
||||
local CONFIG_PATH = "/tmp/etc/" .. CONFIG
|
||||
local CONFIG_PATH = api.S_TMP_PATH
|
||||
local NFT_INCLUDE_FILE = CONFIG_PATH .. "/" .. CONFIG .. ".nft"
|
||||
local LOG_APP_FILE = "/tmp/log/" .. CONFIG .. ".log"
|
||||
local TMP_BIN_PATH = CONFIG_PATH .. "/bin"
|
||||
@@ -53,7 +53,7 @@ local function ln_run(s, d, command, output)
|
||||
end
|
||||
|
||||
local function gen_include()
|
||||
cmd(string.format("echo '#!/bin/sh' > /tmp/etc/%s.include", CONFIG))
|
||||
cmd(string.format("echo '#!/bin/sh' > %s.include", CONFIG_PATH))
|
||||
local function extract_rules(n, a)
|
||||
local _ipt = ipt_bin
|
||||
if n == "6" then
|
||||
@@ -64,7 +64,7 @@ local function gen_include()
|
||||
result = result .. "COMMIT"
|
||||
return result
|
||||
end
|
||||
local f, err = io.open("/tmp/etc/" .. CONFIG .. ".include", "a")
|
||||
local f, err = io.open(CONFIG_PATH .. ".include", "a")
|
||||
if f and err == nil then
|
||||
if nft_flag == "0" then
|
||||
f:write(ipt_bin .. '-save -c | grep -v "PSW2-SERVER" | ' .. ipt_bin .. '-restore -c' .. "\n")
|
||||
@@ -232,7 +232,7 @@ local function stop()
|
||||
cmd("nft flush chain inet fw4 PSW2-SERVER 2>/dev/null")
|
||||
cmd("nft delete chain inet fw4 PSW2-SERVER 2>/dev/null")
|
||||
end
|
||||
cmd(string.format("rm -rf %s %s /tmp/etc/%s.include", CONFIG_PATH, LOG_APP_FILE, CONFIG))
|
||||
cmd(string.format("rm -rf %s %s %s", CONFIG_PATH, LOG_APP_FILE, CONFIG_PATH .. ".include"))
|
||||
end
|
||||
|
||||
if action then
|
||||
|
||||
Reference in new issue
Block a user