luci-app-minieap: add package
This commit is contained in:
parent
ed0cf609de
commit
629bceabdf
@ -34,6 +34,8 @@ luci-app-cupsd source: [F-Light/luci-app-cupsd](https://github.com/F-Light/luci-
|
||||
ootoc-OpenWRT source: [ElonH/ootoc-OpenWRT](https://github.com/ElonH/ootoc-OpenWRT).<br/>
|
||||
r8168 source: [BROBIRD/openwrt-r8168](https://github.com/BROBIRD/openwrt-r8168).<br/>
|
||||
MentoHUST source: [KyleRicardo/MentoHUST-OpenWrt-ipk](https://github.com/KyleRicardo/MentoHUST-OpenWrt-ipk).<br/>
|
||||
luci-app-mentohust source: [BoringCat/luci-app-mentohust](https://github.com/BoringCat/luci-app-mentohust).<br/>
|
||||
luci-app-minieap source: [BoringCat/luci-app-minieap](https://github.com/BoringCat/luci-app-minieap).<br/>
|
||||
scutclient source: [scutclient/scutclient](https://github.com/scutclient/scutclient).<br/>
|
||||
luci-app-scutclient source: [scutclient/luci-app-scutclient](https://github.com/scutclient/luci-app-scutclient).<br/>
|
||||
MT-Wifi 5.0.4.0: [MeIsReallyBa/mt7615-dbdc-linux5.4](https://github.com/MeIsReallyBa/mt7615-dbdc-linux5.4).<br/>
|
||||
|
||||
13
package/ctcgfw/luci-app-minieap/Makefile
Normal file
13
package/ctcgfw/luci-app-minieap/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-minieap
|
||||
PKG_VERSION=1.0.2
|
||||
PKG_RELEASE:=0
|
||||
|
||||
LUCI_TITLE:=minieap 802.1X Client for LuCI
|
||||
LUCI_DESCRIPTION:=This package contains LuCI configuration pages for 8021xclient.
|
||||
LUCI_DEPENDS:=+minieap
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@ -0,0 +1,17 @@
|
||||
module("luci.controller.minieap", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/minieap") then
|
||||
return
|
||||
end
|
||||
if luci.sys.call("command -v minieap >/dev/null") ~= 0 then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "minieap"},
|
||||
alias("admin", "services", "minieap", "general"),
|
||||
_("minieap"), 10).dependent = true
|
||||
|
||||
entry({"admin", "services", "minieap", "general"}, cbi("minieap/general"), _("minieap Settings"), 10).leaf = true
|
||||
-- entry({"admin", "services", "minieap", "customfile"}, cbi("minieap/customfile"), _("custom configfiles"), 20).leaf = true
|
||||
entry({"admin", "services", "minieap", "log"}, cbi("minieap/log"), _("minieap LOG"), 30).leaf = true
|
||||
end
|
||||
@ -0,0 +1,8 @@
|
||||
|
||||
require("luci.sys")
|
||||
|
||||
local f = SimpleForm("minieap",
|
||||
translate("minieap LOG"),
|
||||
translate("Log file:/var/log/minieap.log"))
|
||||
|
||||
return f
|
||||
@ -0,0 +1,150 @@
|
||||
local function is_running(name)
|
||||
if luci.sys.call("pidof %s >/dev/null" %{name}) == 0 then
|
||||
return translate("RUNNING")
|
||||
else
|
||||
return translate("NOT RUNNING")
|
||||
end
|
||||
end
|
||||
|
||||
local function is_online(ipaddr)
|
||||
if ipaddr == "0.0.0.0" or ipaddr == "nil" then
|
||||
return translate("Pinghost not set")
|
||||
end
|
||||
if luci.sys.call("ping -c1 -w1 %s >/dev/null 2>&1" %{ipaddr}) == 0 then
|
||||
return translate("ONLINE")
|
||||
else
|
||||
return translate("NOT ONLINE")
|
||||
end
|
||||
end
|
||||
|
||||
require("luci.sys")
|
||||
|
||||
m = Map("minieap", translate("minieap"), translate("Configure minieap 802.11x."))
|
||||
|
||||
s = m:section(TypedSection, "minieap", translate("Status"))
|
||||
s.anonymous = true
|
||||
status = s:option(DummyValue,"_minieap_status", "minieap")
|
||||
status.value = "<span id=\"_minieap_status\">%s</span>" %{is_running("minieap")}
|
||||
status.rawhtml = true
|
||||
t = io.popen('uci get minieap.@minieap[0].pinghost')
|
||||
netstat=is_online(tostring(t:read("*line")))
|
||||
t:close()
|
||||
if netstat ~= "" then
|
||||
netstatus = s:option(DummyValue,"_network_status", translate("Network Status"))
|
||||
netstatus.value = "<span id=\"_network_status\">%s</span>" %{netstat}
|
||||
netstatus.rawhtml = true
|
||||
end
|
||||
|
||||
o = m:section(TypedSection, "minieap", translate("Settings"))
|
||||
o.addremove = false
|
||||
o.anonymous = true
|
||||
|
||||
o:tab("base", translate("Normal Settings"))
|
||||
o:tab("advanced", translate("Advanced Settings"))
|
||||
o:tab("plugins", translate("Plugins List"))
|
||||
o:tab("ruijie", translate("Ruijie EAP Settings"))
|
||||
|
||||
enable = o:taboption("base", Flag, "enable", translate("Enable"))
|
||||
name = o:taboption("base", Value, "username", translate("Username"),translate("The username given to you by your network administrator"))
|
||||
pass = o:taboption("base", Value, "password", translate("Password"), translate("The password you set or given to you by your network administrator"))
|
||||
pass.password = true
|
||||
|
||||
ifname = o:taboption("base", ListValue, "nic", translate("Interfaces"), translate("Physical interface of WAN"))
|
||||
for k, v in ipairs(luci.sys.net.devices()) do
|
||||
if v ~= "lo" then
|
||||
ifname:value(v)
|
||||
end
|
||||
end
|
||||
|
||||
pinghost = o:taboption("base", Value, "pinghost", translate("PingHost"), translate("Ping host for drop detection, 0.0.0.0 to turn off this feature."))
|
||||
pinghost.default = "0.0.0.0"
|
||||
|
||||
pingintval = o:taboption("base", Value, "pingintval", translate("Ping intval"), translate("Interval of each ping. (in second) [default: 30]"))
|
||||
pingintval.default = "30"
|
||||
|
||||
pingcommand = o:taboption("base", Value, "pingcommand", translate("Offline command"), translate("Run Command when ping failed. [default: minieap -k 1]"))
|
||||
pingcommand:value("minieap -k 1")
|
||||
pingcommand.default = "minieap -k 1"
|
||||
|
||||
stage_timeout = o:taboption("advanced", Value, "stage_timeout", translate("Auth Timeout"), translate("802.11X auth timeout (in second). [default: 5]"))
|
||||
stage_timeout.default = "5"
|
||||
|
||||
wait_after_fail = o:taboption("advanced", Value, "wait_after_fail", translate("Wait after failed"), translate("Wait time between failed and next time (in second). [default: 30]"))
|
||||
wait_after_fail.default = "30"
|
||||
|
||||
max_fail = o:taboption("advanced", Value, "max_fail", translate("Max fail"), translate("Maximum allowed number of failures. [default: 3]"))
|
||||
max_fail.default = "3"
|
||||
|
||||
no_auto_reauth = o:taboption("advanced", ListValue, "no_auto_reauth", translate("Disable auto reauth"), translate("Disable auto reauth after offline. [default: True]"))
|
||||
no_auto_reauth:value(0, translate("False"))
|
||||
no_auto_reauth:value(1, translate("True"))
|
||||
no_auto_reauth.default = 1
|
||||
|
||||
proxy_lan_iface = o:taboption("advanced", Value, "proxy_lan_iface", translate("Proxy LAN's name"), translate("Name of LAN interface when use proxy auth. [default: None]"))
|
||||
proxy_lan_iface.default = ""
|
||||
|
||||
auth_round = o:taboption("advanced", Value, "auth_round", translate("Auth times"), translate("Number of times required for auth. [default: 1]"))
|
||||
auth_round.default = "1"
|
||||
|
||||
max_retries = o:taboption("advanced", Value, "max_retries", translate("Max timeout"), translate("Maximum retry time after timeout. [default: 3]"))
|
||||
max_retries.default = "3"
|
||||
|
||||
pid_file = o:taboption("advanced", Value, "pid_file", translate("PID file"), translate("Path of PID file. (Set 'None' to disable) [default: /var/run/minieap.pid]"))
|
||||
pid_file:value("/var/run/minieap.pid")
|
||||
pid_file.default = "/var/run/minieap.pid"
|
||||
|
||||
if_impl = o:taboption("advanced", ListValue, "if_impl", translate("Network Module"), translate("Network module for send and recv packages (openwrt support sockraw only)"))
|
||||
if_impl:value("sockraw")
|
||||
if_impl.default = "sockraw"
|
||||
|
||||
plugins = o:taboption("plugins", DynamicList, "module", translate("Plugins list"), translate("Packets flow through these plug-ins in sequence. Pay attention to the order in the environment where the package plug-in is modified"))
|
||||
plugins:value("printer", translate("printer: Print length of packets"))
|
||||
plugins:value("rjv3", translate('rjv3: Ruijie 802.11X. Support V3 verification algorithm'))
|
||||
|
||||
heartbeat = o:taboption("ruijie", Value, "heartbeat", translate("Heartbeat interval"), translate("Interval for sending Heartbeat packets (seconds) [Default: 60]"))
|
||||
heartbeat.default = "60"
|
||||
|
||||
eap_bcast_addr = o:taboption("ruijie", ListValue, "eap_bcast_addr", translate("Broadcast address"), translate("Broadcast address type when searching for servers [Default: Standard]"))
|
||||
eap_bcast_addr:value(0, translate("Standard"))
|
||||
eap_bcast_addr:value(1, translate("Ruijie private"))
|
||||
eap_bcast_addr.default = 0
|
||||
|
||||
dhcp_type = o:taboption("ruijie", ListValue, "dhcp_type", translate("DhcpMode"), translate("DHCP method [Default: After certification]"))
|
||||
dhcp_type:value(0, translate("None"))
|
||||
dhcp_type:value(1, translate("Secondary authentication"))
|
||||
dhcp_type:value(2, translate("Before certification"))
|
||||
dhcp_type:value(3, translate("After certification"))
|
||||
dhcp_type.default = 3
|
||||
|
||||
dhcp_script = o:taboption("ruijie", Value, "dhcp_script", translate("DhcpScript"), translate("DHCP script [Default: None]"))
|
||||
dhcp_script.default = ""
|
||||
|
||||
service = o:taboption("ruijie", Value, "service", translate("Service"), translate("Service From Ruijie Server [Default: internet]"))
|
||||
service.default = "internet"
|
||||
|
||||
version_str = o:taboption("ruijie", Value, "version_str", translate("Version String"), translate("Custom version [Default: RG-SU For Linux V1.0]"))
|
||||
version_str:value("RG-SU For Linux V1.0")
|
||||
version_str.default = "RG-SU For Linux V1.0"
|
||||
|
||||
fake_dns1 = o:taboption("ruijie", Value, "fake_dns1", translate("Main DNS server"), translate("Custom main DNS server [Default: FromSystem]"))
|
||||
|
||||
fake_dns2 = o:taboption("ruijie", Value, "fake_dns2", translate("Second DNS server"), translate("Custom second DNS server [Default: FromSystem]"))
|
||||
|
||||
fake_serial = o:taboption("ruijie", Value, "fake_serial", translate("Disk serial"), translate("Custom disk serial [Default: From /etc/mtab]"))
|
||||
|
||||
max_dhcp_count = o:taboption("ruijie", Value, "max_dhcp_count", translate("DHCP try times"), translate("DHCP try times [Default: 3]"))
|
||||
max_dhcp_count.default = "3"
|
||||
|
||||
rj_option = o:taboption("ruijie", DynamicList, "rj_option", translate("Custom EAP Options"), translate("Format <type>:<value>[:r]. Add a option type: <type>, value: <value>. :r for replace"))
|
||||
|
||||
if nixio.fs.mkdir("/etc/minieap.conf.d") == true then
|
||||
nixio.fs.symlink("/etc/minieap.conf.d/minieap.conf.utf8", "/etc/minieap.conf")
|
||||
end
|
||||
|
||||
local apply = luci.http.formvalue("cbi.apply")
|
||||
if apply then
|
||||
luci.sys.call("minieap-conver | sort > /etc/minieap.conf.d/minieap.conf.utf8")
|
||||
io.popen("/etc/init.d/minieap restart")
|
||||
end
|
||||
|
||||
return m
|
||||
@ -0,0 +1,23 @@
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local f = SimpleForm("minieap",
|
||||
translate("minieap LOG"),
|
||||
translate("Log file:/var/log/minieap.log"))
|
||||
|
||||
local o = f:field(Value, "minieap_log")
|
||||
|
||||
o.template = "cbi/tvalue"
|
||||
o.rows = 32
|
||||
|
||||
function o.cfgvalue(self, section)
|
||||
return fs.readfile("/var/log/minieap.log")
|
||||
end
|
||||
|
||||
function o.write(self, section, value)
|
||||
require("luci.sys").call('cat /dev/null > /var/log/minieap.log 2>/dev/null')
|
||||
end
|
||||
|
||||
f.submit = translate("Clear log")
|
||||
f.reset = false
|
||||
|
||||
return f
|
||||
227
package/ctcgfw/luci-app-minieap/po/zh_Hans/minieap.po
Normal file
227
package/ctcgfw/luci-app-minieap/po/zh_Hans/minieap.po
Normal file
@ -0,0 +1,227 @@
|
||||
msgid "minieap Settings"
|
||||
msgstr "minieap 设置"
|
||||
|
||||
msgid "minieap LOG"
|
||||
msgstr "minieap 日志"
|
||||
|
||||
msgid "Log file:/var/log/minieap.log"
|
||||
msgstr "日志文件: /var/log/minieap.log"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Pinghost not set"
|
||||
msgstr "没有设置Ping主机"
|
||||
|
||||
msgid "ONLINE"
|
||||
msgstr "能访问互联网"
|
||||
|
||||
msgid "NOT ONLINE"
|
||||
msgstr "不能访问互联网"
|
||||
|
||||
msgid "Configure minieap 802.11x."
|
||||
msgstr "配置minieap 802.11x验证。"
|
||||
|
||||
msgid "Network Status"
|
||||
msgstr "网络状态"
|
||||
|
||||
msgid "Settings"
|
||||
msgstr "设置"
|
||||
|
||||
msgid "Normal Settings"
|
||||
msgstr "常规设置"
|
||||
|
||||
msgid "Plugins List"
|
||||
msgstr "插件列表"
|
||||
|
||||
msgid "Ruijie EAP Settings"
|
||||
msgstr "锐捷认证设置"
|
||||
|
||||
msgid "The username given to you by your network administrator"
|
||||
msgstr "您的用户名(或管理员分配的用户名)"
|
||||
|
||||
msgid "The password you set or given to you by your network administrator"
|
||||
msgstr "您的密码(或管理员分配的密码)"
|
||||
|
||||
msgid "Physical interface of WAN"
|
||||
msgstr "WAN口的物理接口"
|
||||
|
||||
msgid "PingHost"
|
||||
msgstr "Ping主机"
|
||||
|
||||
msgid "Ping host for drop detection, 0.0.0.0 to turn off this feature."
|
||||
msgstr "Ping主机,用于掉线检测,0.0.0.0表示关闭该功能"
|
||||
|
||||
msgid "Packets flow through these plug-ins in sequence. Pay attention to the order in the environment where the package plug-in is modified"
|
||||
msgstr "数据包会按顺序流经这些插件。在有修改数据包插件的环境中请注意顺序"
|
||||
|
||||
msgid "printer: Print length of packets"
|
||||
msgstr "printer:打印流入流出数据包的大小"
|
||||
|
||||
msgid "rjv3: Ruijie 802.11X. Support V3 verification algorithm"
|
||||
msgstr "rjv3:锐捷认证,支持V3算法"
|
||||
|
||||
msgid "Heartbeat interval"
|
||||
msgstr "心跳间隔"
|
||||
|
||||
msgid "Interval for sending Heartbeat packets (seconds) [Default: 60]"
|
||||
msgstr "发送心跳包的间隔(秒)[默认:60]"
|
||||
|
||||
msgid "Broadcast address"
|
||||
msgstr "广播地址类型"
|
||||
|
||||
msgid "Broadcast address type when searching for servers [Default: Standard]"
|
||||
msgstr "寻找服务器时的广播地址类型 [默认:标准]"
|
||||
|
||||
msgid "Standard"
|
||||
msgstr "标准"
|
||||
|
||||
msgid "Ruijie private"
|
||||
msgstr "锐捷私有"
|
||||
|
||||
msgid "DhcpMode"
|
||||
msgstr "DHCP方式"
|
||||
|
||||
msgid "DHCP method [Default: After certification]"
|
||||
msgstr "DHCP方式 [默认:认证后]"
|
||||
|
||||
msgid "None"
|
||||
msgstr "无"
|
||||
|
||||
msgid "Secondary authentication"
|
||||
msgstr "二次认证"
|
||||
|
||||
msgid "Before certification"
|
||||
msgstr "认证前"
|
||||
|
||||
msgid "After certification"
|
||||
msgstr "认证后"
|
||||
|
||||
msgid "DhcpScript"
|
||||
msgstr "DHCP脚本"
|
||||
|
||||
msgid "DHCP script [Default: None]"
|
||||
msgstr "DHCP脚本 [默认:无]"
|
||||
|
||||
msgid "Service"
|
||||
msgstr "服务"
|
||||
|
||||
msgid "Service From Ruijie Server [Default: internet]"
|
||||
msgstr "锐捷认证服务器上配置的用户服务"
|
||||
|
||||
msgid "Version String"
|
||||
msgstr "版本信息"
|
||||
|
||||
msgid "Custom version [Default: RG-SU For Linux V1.0]"
|
||||
msgstr "自定义版本信息 [默认:RG-SU For Linux V1.0]"
|
||||
|
||||
msgid "Main DNS server"
|
||||
msgstr "主DNS服务器"
|
||||
|
||||
msgid "Custom main DNS server [Default: FromSystem]"
|
||||
msgstr "自定义主DNS服务器 [默认:自动获取]"
|
||||
|
||||
msgid "Second DNS server"
|
||||
msgstr "从DNS服务器"
|
||||
|
||||
msgid "Custom second DNS server [Default: FromSystem]"
|
||||
msgstr "自定义从DNS服务器 [默认:自动获取]"
|
||||
|
||||
msgid "Disk serial"
|
||||
msgstr "磁盘序列号"
|
||||
|
||||
msgid "Custom disk serial [Default: From /etc/mtab]"
|
||||
msgstr "自定义磁盘序列号 [默认:自动获取]"
|
||||
|
||||
msgid "DHCP try times"
|
||||
msgstr "DHCP尝试次数"
|
||||
|
||||
msgid "DHCP try times [Default: 3]"
|
||||
msgstr "二次认证的DHCP尝试次数 [默认:3]"
|
||||
|
||||
msgid "Custom EAP Options"
|
||||
msgstr "自定义EAP字段"
|
||||
|
||||
msgid "Format <type>:<value>[:r]. Add a option type: <type>, value: <value>. :r for replace"
|
||||
msgstr "格式: <type>:<value>[:r]。 不带r为增加字段,带r为替换字段"
|
||||
|
||||
msgid "Configfile encoding"
|
||||
msgstr "配置文件编码"
|
||||
|
||||
msgid "Auth Timeout"
|
||||
msgstr "认证超时"
|
||||
|
||||
msgid "802.11X auth timeout (in second). [default: 5]"
|
||||
msgstr "单个认证阶段的超时时间 [默认:5]"
|
||||
|
||||
msgid "Wait after failed"
|
||||
msgstr "认证失败等待"
|
||||
|
||||
msgid "Wait time between failed and next time (in second). [default: 30]"
|
||||
msgstr "认证失败后重新认证前的等待时间[默认:30]"
|
||||
|
||||
msgid "Max fail"
|
||||
msgstr "最大失败次数"
|
||||
|
||||
msgid "Maximum allowed number of failures. [default: 3]"
|
||||
msgstr "最大允许认证失败次数 [默认:3]"
|
||||
|
||||
msgid "Disable auto reauth"
|
||||
msgstr "禁止自动重连"
|
||||
|
||||
msgid "Disable auto reauth after offline. [default: True]"
|
||||
msgstr "认证掉线后不允许自动重连 [默认:是]"
|
||||
|
||||
msgid "False"
|
||||
msgstr "否"
|
||||
|
||||
msgid "True"
|
||||
msgstr "是"
|
||||
|
||||
msgid "Daemon mode"
|
||||
msgstr "运行模式"
|
||||
|
||||
msgid "Proxy LAN's name"
|
||||
msgstr "代理LAN口名称"
|
||||
|
||||
msgid "Name of LAN interface when use proxy auth. [default: None]"
|
||||
msgstr "代理认证时的 LAN 网络界面名 [默认:无]"
|
||||
|
||||
msgid "Auth times"
|
||||
msgstr "认证次数"
|
||||
|
||||
msgid "Number of times required for auth. [default: 1]"
|
||||
msgstr "需要认证的次数 [默认:1]"
|
||||
|
||||
msgid "Max timeout"
|
||||
msgstr "最大超时重试"
|
||||
|
||||
msgid "Maximum retry time after timeout. [default: 3]"
|
||||
msgstr "最大超时重试的次数 [默认:3]"
|
||||
|
||||
msgid "PID file"
|
||||
msgstr "PID文件"
|
||||
|
||||
msgid "Path of PID file. (Set 'None' to disable) [default: /var/run/minieap.pid]"
|
||||
msgstr "PID 文件路径,设为none可禁用 [默认:/var/run/minieap.pid]"
|
||||
|
||||
msgid "Network Module"
|
||||
msgstr "网络操作模块"
|
||||
|
||||
msgid "Network module for send and recv packages (openwrt support sockraw only)"
|
||||
msgstr "选择此网络操作模块(openwrt只支持sockraw)"
|
||||
|
||||
msgid "Ping intval"
|
||||
msgstr "Ping间隔"
|
||||
|
||||
msgid "Interval of each ping. (in second) [default: 30]"
|
||||
msgstr "Ping Ping主机的间隔(秒) [默认:30]"
|
||||
|
||||
msgid "Offline command"
|
||||
msgstr "掉线执行命令"
|
||||
|
||||
msgid "Run Command when ping failed. [default: minieap -k 1]"
|
||||
msgstr "Ping 检测到掉线后执行的命令 [默认: minieap -k 1]"
|
||||
18
package/ctcgfw/luci-app-minieap/root/etc/config/minieap
Normal file
18
package/ctcgfw/luci-app-minieap/root/etc/config/minieap
Normal file
@ -0,0 +1,18 @@
|
||||
config minieap
|
||||
option pinghost '0.0.0.0'
|
||||
option pingintval '30'
|
||||
option pingcommand 'minieap -k 1'
|
||||
option stage_timeout '5'
|
||||
option wait_after_fail '30'
|
||||
option max_fail '3'
|
||||
option no_auto_reauth '1'
|
||||
option auth_round '1'
|
||||
option max_retries '3'
|
||||
option pid_file '/var/run/minieap.pid'
|
||||
option if_impl 'sockraw'
|
||||
option heartbeat '60'
|
||||
option eap_bcast_addr '0'
|
||||
option dhcp_type '3'
|
||||
option service 'internet'
|
||||
option version_str 'RG-SU For Linux V1.0'
|
||||
option max_dhcp_count '3'
|
||||
67
package/ctcgfw/luci-app-minieap/root/etc/init.d/minieap
Normal file
67
package/ctcgfw/luci-app-minieap/root/etc/init.d/minieap
Normal file
@ -0,0 +1,67 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
|
||||
run_minieap()
|
||||
{
|
||||
kill $(cat /var/log/minieap-ping.pid 2>/dev/null) 2>/dev/null
|
||||
local enable
|
||||
local username
|
||||
local password
|
||||
local nic
|
||||
local pinghost
|
||||
config_get_bool enable $1 enable
|
||||
config_get username $1 username
|
||||
config_get password $1 password
|
||||
config_get nic $1 nic
|
||||
config_get pinghost $1 pinghost
|
||||
|
||||
if [ $enable ] && [ $username ] && [ $password ] && [ $nic ]; then
|
||||
if [ $pinghost ]; then
|
||||
/bin/ash -c "/usr/sbin/minieap-ping &"
|
||||
fi
|
||||
/bin/ash -c "minieap -b3"
|
||||
else
|
||||
/bin/ash -c "minieap -k"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_minieap()
|
||||
{
|
||||
kill $(cat /var/log/minieap-ping.pid 2>/dev/null) 2>/dev/null
|
||||
local enable
|
||||
local username
|
||||
local password
|
||||
local nic
|
||||
local pinghost
|
||||
config_get_bool enable $1 enable
|
||||
config_get username $1 username
|
||||
config_get password $1 password
|
||||
config_get nic $1 nic
|
||||
config_get pinghost $1 pinghost
|
||||
if [ $enable ] && [ $username ] && [ $password ] && [ $nic ]; then
|
||||
if [ $pinghost ]; then
|
||||
/bin/ash -c "/usr/sbin/minieap-ping &"
|
||||
fi
|
||||
/bin/ash -c "minieap -k 1"
|
||||
else
|
||||
/bin/ash -c "minieap -k"
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load minieap
|
||||
config_foreach run_minieap minieap
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill $(cat /var/log/minieap-ping.pid 2>/dev/null) 2>/dev/null
|
||||
/bin/ash -c "minieap -k"
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
config_load minieap
|
||||
config_foreach restart_minieap minieap
|
||||
}
|
||||
13
package/ctcgfw/luci-app-minieap/root/usr/sbin/minieap-conver
Normal file
13
package/ctcgfw/luci-app-minieap/root/usr/sbin/minieap-conver
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
default_config='''daemonize=3
|
||||
'''
|
||||
|
||||
echo $default_config
|
||||
config_keys=$(uci show minieap | cut -d "." -f3- | awk -F "=" '{if ($0 != "") print $1}')
|
||||
for key in $config_keys
|
||||
do
|
||||
if [[ "$key" != "pinghost" ]] && [[ "$key" != "pingintval" ]]; then
|
||||
echo ${key//_/-}=$(uci get minieap.@minieap[0].$key)
|
||||
fi
|
||||
done
|
||||
24
package/ctcgfw/luci-app-minieap/root/usr/sbin/minieap-ping
Normal file
24
package/ctcgfw/luci-app-minieap/root/usr/sbin/minieap-ping
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
kill $(cat /var/log/minieap-ping.pid 2>/dev/null) 2>/dev/null
|
||||
|
||||
echo $$ > /var/log/minieap-ping.pid
|
||||
|
||||
ping_host=$(uci get minieap.@minieap[0].pinghost)
|
||||
ping_intval=$(uci get minieap.@minieap[0].pingintval)
|
||||
ping_command=$(uci get minieap.@minieap[0].pingcommand)
|
||||
ipint=$(echo $ping_host | awk -F "." '{print $1*2**8**3 + $2*2**8**2 + $3*2**8 + $4}')
|
||||
if [[ $ipint -le 0 ]] || [[ $ipint -ge 4294967295 ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -z $ping_host ]; then
|
||||
while true
|
||||
do
|
||||
ping -c1 -w1 $ping_host > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
$ping_command
|
||||
fi
|
||||
sleep $ping_intval
|
||||
done
|
||||
fi
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-minieap": {
|
||||
"description": "Grant UCI access for luci-app-minieap",
|
||||
"read": {
|
||||
"uci": [ "minieap" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "minieap" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user