🎄 Sync 2026-04-23 03:14:31

This commit is contained in:
github-actions[bot] committed 2026-04-23 03:14:31 +08:00
1 parent a011aeb96f
commit 263d407c11
97 files changed
+4710 -1

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-hotplug
LUCI_TITLE:=LuCI interface for hotplug configuration
LUCI_DEPENDS:=+luci-base
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,47 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('hotplug', _('Interface Rules'));
m.description = _('Running commands when the hotplug trigger occurs. <br/><br/>ACTION - ifdown, ifup, ifup-failed, ifupdate, free, reload, iflink, create <br/>INTERFACE - Name of the logical interface which went up or down (e.g. wan or lan) <br/>DEVICE - Name of the physical device which went up or down (e.g. eth0 or br-lan or pppoe-wan), when applicable <br/><br/>More information about iface events and variables here: <a href=\"https://openwrt.org/docs/guide-user/base-system/hotplug#iface\">hotplug#iface</a>');
s = m.section(form.GridSection, 'iface');
s.addremove = true;
s.nodescriptions = true;
o = s.option(form.TextValue, 'description', _('Description'));
o = s.option(form.Flag, 'enabled', _('Activate'));
o.rmempty = false;
o.editable = true;
o = s.option(form.ListValue, 'action', _('Variable $ACTION'), _('The type of event that will trigger the command'));
o.default = "ifup";
o.value("ifup", _("iface up (ifup)"));
o.value("ifdown", _("iface down (ifdown)"));
o.value("ifup-failed", _("iface up failed (ifup-failed)"));
o.value("ifupdate", _("iface changed (ifupdate)"));
o.value("free", _("iface removed (free)"));
o.value("reload", _("iface reload (reload)"));
o.value("iflink", _("Iface received link (iflink)"));
o.value("create", _("iface created (create)"));
o = s.option(widgets.NetworkSelect, 'interface', _('Variable $INTERFACE'), _('The name of the logical interface to which the command will be applied'));
o.default = "internet";
o.rmempty = false;
o.textvalue = function(section_id) {
return uci.get('hotplug', section_id, 'interface');
}
o = s.option(form.DynamicList, 'command', _('Command to execute'));
return m.render();
}
});
@@ -0,0 +1,59 @@
'use strict';
'require form';
'require view';
'require uci';
'require rpc';
'require tools.widgets as widgets';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('hotplug', _('Network Rules'));
m.description = _('Running commands when the hotplug trigger occurs. <br/>\
<br/>\
ACTION - "add" or "remove" noted <br/>\
DEVICENAME - configured interface names (br-lan, wlan0, phy1-ap0) <br/>\
PATH - full path<br/>\
DEVPATH - full device path (for example “/devices/pci0000:00/0000:00:0b.0/usb1/1-1/1-1:1.0/host7/target7:0:0/7:0:0:0/block/sdc/sdc1”)<br/>\
DEVTYPE - what the DEVICENAME are names of, ie. br-lan, phy1-ap0 <br/ >\
INTERFACE - configured interfaces as in DEVTYPE <br/>\
SEQNUM - seqnum (a number) <br/>\
SUBSYSTEM - always = “net” <br/>\
IFINDEX - appears to be related to the configured interfaces. See ifconfig <br/>\
More information about net event here: <a href="https://openwrt.org/docs/guide-user/base-system/hotplug#net">hotplug#net</a>');
s = m.section(form.GridSection, 'hotplug');
s.addremove = true;
s.nodescriptions = true;
o = s.option(form.Flag, 'enabled', _('Enabled'));
o.rmempty = false;
o = s.option(widgets.NetworkSelect, 'iface', _('Ping interface'));
o.rmempty = false;
o.textvalue = function(section_id) {
return uci.get('hotplug', section_id, 'iface');
}
o = s.option(form.DynamicList, 'testip', _('IP address or hostname of test servers'));
o.datatype = 'or(hostname,ipaddr("nomask"))';
o = s.option(form.Value, 'check_period', _('Period of check, sec'));
o.rmempty = false;
o.datatype = 'and(uinteger,min(20))';
o.default = '60';
o = s.option(form.Value, 'sw_before_modres', _('Failed attempts before iface up/down'), _('0 - not used'));
o.rmempty = false;
o.datatype = 'and(uinteger,min(0),max(100))';
o.default = '3';
o = s.option(form.Value, 'sw_before_sysres', _('Failed attempts before reboot'), _('0 - not used'));
o.rmempty = false;
o.datatype = 'and(uinteger,min(0),max(100))';
o.default = '0';
return m.render();
}
});
+29
View File
@@ -0,0 +1,29 @@
msgid "Hotplug Rules"
msgstr "Hotplug Rules"
msgid "Interface Rules"
msgstr "Interface Rules"
msgid "Description"
msgstr "Description"
msgid "Activate"
msgstr "Activate"
msgid "Variable $ACTION"
msgstr "Variable $ACTION"
msgid "The type of event that will trigger the command"
msgstr "The type of event that will trigger the command"
msgid "Variable $INTERFACE"
msgstr "Variable $INTERFACE"
msgid "The name of the logical interface to which the command will be applied"
msgstr "The name of the logical interface to which the command will be applied"
msgid "Command to execute"
msgstr "Command to execute"
msgid "Running commands when the hotplug trigger occurs. <br/><br/>ACTION - ifdown, ifup, ifup-failed, ifupdate, free, reload, iflink, create <br/>INTERFACE - Name of the logical interface which went up or down (e.g. wan or lan) <br/>DEVICE - Name of the physical device which went up or down (e.g. eth0 or br-lan or pppoe-wan), when applicable <br/><br/>More information about iface events and variables here: <a href=\"https://openwrt.org/docs/guide-user/base-system/hotplug#iface\">hotplug#iface</a>"
msgstr "Running commands when the hotplug trigger occurs. <br/><br/>ACTION - ifdown, ifup, ifup-failed, ifupdate, free, reload, iflink, create <br/>INTERFACE - Name of the logical interface which went up or down (e.g. wan or lan) <br/>DEVICE - Name of the physical device which went up or down (e.g. eth0 or br-lan or pppoe-wan), when applicable <br/><br/>More information about iface events and variables here: <a href=\"https://openwrt.org/docs/guide-user/base-system/hotplug#iface\">hotplug#iface</a>"
+29
View File
@@ -0,0 +1,29 @@
msgid "Hotplug Rules"
msgstr "Автоматизация (Hotplug)"
msgid "Interface Rules"
msgstr "Правила для интерфейсов"
msgid "Description"
msgstr "Описание"
msgid "Activate"
msgstr "Активировать"
msgid "Variable $ACTION"
msgstr "Переменная $ACTION"
msgid "The type of event that will trigger the command"
msgstr "Тип события, при котором будет выполнена команда"
msgid "Variable $INTERFACE"
msgstr "Переменная $INTERFACE"
msgid "The name of the logical interface to which the command will be applied"
msgstr "Имя логического интерфейса, к которому будет применимо правило"
msgid "Command to execute"
msgstr "Команда для выполнения"
msgid "Running commands when the hotplug trigger occurs. <br/><br/>ACTION - ifdown, ifup, ifup-failed, ifupdate, free, reload, iflink, create <br/>INTERFACE - Name of the logical interface which went up or down (e.g. wan or lan) <br/>DEVICE - Name of the physical device which went up or down (e.g. eth0 or br-lan or pppoe-wan), when applicable <br/><br/>More information about iface events and variables here: <a href=\"https://openwrt.org/docs/guide-user/base-system/hotplug#iface\">hotplug#iface</a>"
msgstr "Выполнение команд при срабатывании триггера hotplug. <br/><br/>ACTION - ifdown, ifup, ifup-failed, ifupdate, free, reload, iflink, create <br/>INTERFACE - имя логического интерфейса, который был активирован или деактивирован (например, wan или lan) <br/>DEVICE - имя физического устройства, которое было активировано или деактивировано (например, eth0, br-lan или pppoe-wan), если применимо <br/><br/>Подробнее о событиях интерфейсов и переменных: <a href=\"https://openwrt.org/docs/guide-user/base-system/hotplug#iface\">hotplug#iface</a>"
@@ -0,0 +1,19 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-hotplug.json" ] && {
cat > /usr/share/ucitrack/luci-app-hotplug.json << EEOF
{
"config": "hotplug",
"init": "hotplug"
}
EEOF
}
uci -q batch <<-EOF >/dev/null
delete ucitrack.@hotplug[-1]
add ucitrack hotplug
set ucitrack.@hotplug[-1].init=hotplug
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0
@@ -0,0 +1,23 @@
{
"admin/services/hotplug": {
"title": "Hotplug Rules",
"order": 25,
"action": {
"type": "alias",
"path": "admin/services/hotplug/iface"
},
"depends": {
"acl": [ "luci-app-hotplug" ],
"uci": { "hotplug": true }
}
},
"admin/services/hotplug/iface": {
"title": "iface",
"order": 20,
"action": {
"type": "view",
"path": "hotplug/iface"
}
}
}
@@ -0,0 +1,11 @@
{
"luci-app-hotplug": {
"description": "Grant UCI access for luci-app-hotplug",
"read": {
"uci": [ "hotplug" ]
},
"write": {
"uci": [ "hotplug" ]
}
}
}