Skip to content

Commit

Permalink
add luci web control support for njit8021xclient
Browse files Browse the repository at this point in the history
  • Loading branch information
ferstar committed Nov 6, 2013
1 parent 0b0eb1a commit ec215d1
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 0 deletions.
3 changes: 3 additions & 0 deletions feeds/luci/luci/Makefile
Expand Up @@ -455,6 +455,9 @@ $(eval $(call application,pptpd,pptpd configuration module,\
$(eval $(call application,transmission,transmission configuration module,\
+PACKAGE_luci-app-transmission:transmission-daemon +transmission-remote +transmission-web))

$(eval $(call application,njit,njit configuration module,\
+PACKAGE_luci-app-njit:njit8021xclient))

$(eval $(call application,nwan,nwan configuration module,\
+PACKAGE_luci-app-nwan:ip +kmod-macvlan +iptables +iptables-mod-conntrack +iptables-mod-conntrack-extra +iptables-mod-ipopt))

Expand Down
4 changes: 4 additions & 0 deletions feeds/luci/luci/luci/applications/luci-njit/Makefile
@@ -0,0 +1,4 @@
PO = njit

include ../../build/config.mk
include ../../build/module.mk
1 change: 1 addition & 0 deletions feeds/luci/luci/luci/applications/luci-njit/ipkg/conffiles
@@ -0,0 +1 @@
/etc/njit.conf
9 changes: 9 additions & 0 deletions feeds/luci/luci/luci/applications/luci-njit/ipkg/postinst
@@ -0,0 +1,9 @@
#!/bin/sh

[ -n "${IPKG_INSTROOT}" ] || {
( . /etc/uci-defaults/luci-njit ) && rm -f /etc/uci-defaults/luci-njit
chmod 755 /etc/init.d/njit >/dev/null 2>&1
/etc/init.d/njit enable >/dev/null 2>&1

exit 0
}
5 changes: 5 additions & 0 deletions feeds/luci/luci/luci/applications/luci-njit/ipkg/postrm
@@ -0,0 +1,5 @@
#!/bin/sh
uci delete ucitrack.@njit[-1] >/dev/null 2>&1
uci commit ucitrack

exit 0
@@ -0,0 +1,19 @@
--[[
LuCI njit
Author:ferstar
Email:zhangjianfei3@gmail.com
]]--

module("luci.controller.njit", package.seeall)

function index()

if nixio.fs.access("/etc/config/njit") then
local page
page = entry({"admin", "services", "njit"}, cbi("njit"), _("NJIT-CLIENT"))
page.i18n = "njit"
page.dependent = true
end
end
@@ -0,0 +1,29 @@
--[[
LuCI njit
#Author:ferstar
#Email:zhangjianfei3@gmail.com
]]--

require("luci.tools.webadmin")

m = Map("njit", translate("njit"), translate("A H3C supplicant on Linux"))

s = m:section(TypedSection, "njit", translate("Config njit"),translate("The options below are all of njit's arguments."))
s.anonymous = true

s:option(Value, "Username", translate("Username")).default="xxx"

pw=s:option(Value, "Password", translate("Password"))
pw.password = true
pw.rmempty = false
pw.default= "***"

nic=s:option(ListValue, "Nic", translate("net card name"),translate("Please make sure you have chose the right net card."))
nic.anonymous = true
for k, v in pairs(luci.sys.net.devices()) do
nic:value(v)
end

return m
14 changes: 14 additions & 0 deletions feeds/luci/luci/luci/applications/luci-njit/root/etc/config/cron
@@ -0,0 +1,14 @@
config 'task'
option 'enabled' '1'
option 'task_name' 'reloading'
option 'task_Everyday' '1'
option 'task_Monday' '0'
option 'task_Tuesday' '0'
option 'task_Wednesday' '0'
option 'task_Thursday' '0'
option 'task_Friday' '0'
option 'task_Sartuday' '0'
option 'task_Sunday' '0'
option 'task_time' '6:45'
option 'task_task' '/etc/init.d/njit restart'

@@ -0,0 +1,4 @@
config 'njit'
option 'Nic' 'eth0.2'
option 'Username' 'ferstar'
option 'Password' '123456'
21 changes: 21 additions & 0 deletions feeds/luci/luci/luci/applications/luci-njit/root/etc/init.d/njit
@@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
#Author:ferstar
#Email:zhangjianfei3@gmail.com

START=55

start()
{
njit-client $(uci get njit.@njit[0].Username) $(uci get njit.@njit[0].Password) $(uci get njit.@njit[0].Nic) &
}

stop()
{
killall njit-client
}

restart()
{
stop
start
}
@@ -0,0 +1,11 @@
#!/bin/sh

uci -q batch <<-EOF >/dev/null
delete ucitrack.@njit[-1]
add ucitrack njit
set ucitrack.@njit[-1].init=njit
commit ucitrack
EOF

rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,3 @@
#!/bin/sh
killall udhcpc
udhcpc -t 0 -i $(uci get njit.@njit[0].Nic) -b -p /var/run/dhcp-$(uci get njit.@njit[0].Nic).pid
29 changes: 29 additions & 0 deletions feeds/luci/luci/luci/po/zh_CN/njit.po
@@ -0,0 +1,29 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"

msgid "njit"
msgstr "西北大学H3C认证"

msgid "A H3C supplicant on Linux"
msgstr "一个用于linux h3c上网认证的前端程序 源码作者:liuqun 前端作者:ferstar"

msgid "Config njit"
msgstr "配置客户端"

msgid "NJIT-CLIENT"
msgstr "校园网认证"

msgid "Password"
msgstr "密码"

msgid "The options below are all of njit's arguments."
msgstr "填入下列要求信息后请点击保存应用,很快路由器即可完成拨号认证,以后路由器启动会自动拨号认证,无需人工干预"

msgid "Username"
msgstr "帐号/学号"

msgid "net card name"
msgstr "网卡名"

msgid "Please make sure you have chose the right net card."
msgstr "请确定您选择了正确的网卡,稳定版OP一般会是eth0.2,对应WAN口"

0 comments on commit ec215d1

Please sign in to comment.