mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 12:23:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
########################## package style makefile ##########################
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-switchtools
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI switch tools
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI support for switch configure
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
cp -pR ./root/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/switchtools.po $(1)/usr/lib/lua/luci/i18n/switchtools.zh-cn.lmo
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
||||
--- Created by thomas.
|
||||
--- DateTime: 10/17/20 11:39 AM
|
||||
---
|
||||
module("luci.controller.admin.exc_nwk", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({ "admin", "exc_nwk" }, firstchild(), translate("Switch Settings"), 75).dependent = false
|
||||
entry({ "admin", "exc_nwk", "mode" }, cbi("exc_nwk/workmode"), translate("Mode"), 1)
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
||||
--- Created by thomas.
|
||||
--- DateTime: 9/7/20 5:17 PM
|
||||
---
|
||||
|
||||
m = Map("switchmode", translate("Gateway work mode"))
|
||||
s = m:section(NamedSection, "settings", "workmode")
|
||||
o = s:option(ListValue, "mode", translate("Mode"))
|
||||
o:value("0", translate("Switch mode"))
|
||||
o:value("1", translate("Route mode"))
|
||||
o.default = "1"
|
||||
o.rmempty = true
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,11 @@
|
||||
msgid "Switch Settings"
|
||||
msgstr "交换芯片设置"
|
||||
|
||||
msgid "Gateway work mode"
|
||||
msgstr "网关工作模式"
|
||||
|
||||
msgid "Route mode"
|
||||
msgstr "路由器模式"
|
||||
|
||||
msgid "Switch mode"
|
||||
msgstr "交换机模式"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
zh-cn
|
||||
@@ -0,0 +1,2 @@
|
||||
config workmode 'settings'
|
||||
option mode '1'
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-switchmode.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-switchmode.json << EEOF
|
||||
{
|
||||
"config": "switchmode",
|
||||
"init": "switchmode"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@switchmode[-1]
|
||||
add ucitrack switchmode
|
||||
add_list ucitrack.@switchmode[-1].affects=network
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/config/uci.sh
|
||||
|
||||
setup_switch() {
|
||||
echo "setup_switch"
|
||||
|
||||
# if eth0 not up,action of switch setting will crash
|
||||
ifconfig eth0 up
|
||||
|
||||
# reset switch
|
||||
switch 2
|
||||
# /etc/init.d/macbind2port reload
|
||||
|
||||
mode=$(uci_get switchmode.settings.mode)
|
||||
wifich=$(uci_get wireless.wlan0.channel)
|
||||
|
||||
# a urgly method!
|
||||
# change wifi channel,force wifi reload, so than 'brctl addif wlan0' be executed
|
||||
# if [ "$wifich" -eq 14 ]; then
|
||||
# wifich=11
|
||||
# else
|
||||
# wifich=$(expr $wifich + 1);
|
||||
# fi
|
||||
|
||||
if [ "$mode" = "1" ]; then
|
||||
uci -q batch <<-EOF
|
||||
set network.wan.device='eth0.1'
|
||||
set network.wan6.device='eth0.1'
|
||||
set network.lan=interface
|
||||
set network.lan.type='bridge'
|
||||
set network.lan.proto='static'
|
||||
set network.lan.ipaddr='192.168.1.1'
|
||||
set network.lan.netmask='255.255.255.0'
|
||||
set network.lan.ip6assign='60'
|
||||
set network.lan.device='eth0.2'
|
||||
set wireless.wlan0.channel='$wifich'
|
||||
EOF
|
||||
# WLLL,router mode
|
||||
switch 1
|
||||
elif [ "$mode" = "0" ]; then
|
||||
uci -q batch <<-EOF
|
||||
set network.wan.device='eth0'
|
||||
set network.wan6.device='eth0'
|
||||
delete network.lan
|
||||
set network.lan.ip6assign='60'
|
||||
set network.lan=interface
|
||||
set network.lan.type='bridge'
|
||||
set network.lan.proto='static'
|
||||
set network.lan.ipaddr='192.168.1.1'
|
||||
set network.lan.netmask='255.255.255.0'
|
||||
set network.lan.device='wlan0'
|
||||
set wireless.wlan0.channel='$wifich'
|
||||
EOF
|
||||
# restore_ip175d, defualt is switch mode
|
||||
switch 0
|
||||
else
|
||||
echo "invalid mode value"
|
||||
fi
|
||||
uci commit
|
||||
}
|
||||
|
||||
reset_switch() {
|
||||
# reset ip175d
|
||||
switch 2
|
||||
echo "reset_switch"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"luci-app-switchtools": {
|
||||
"description": "Grant UCI access for luci-app-switchtools",
|
||||
"read": {
|
||||
"uci": [
|
||||
"switchmode"
|
||||
]
|
||||
},
|
||||
"write": {
|
||||
"uci": [
|
||||
"switchmode"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user