luci-mod-network: gate bonding behind kmod presence
authorPaul Donald <redacted>
Thu, 19 Dec 2024 18:41:25 +0000 (18:41 +0000)
committerPaul Donald <redacted>
Thu, 19 Dec 2024 18:44:47 +0000 (18:44 +0000)
The kmod install link only displays in new device dialogues so as not
to be too prominent.

Closes #6996
Closes #7086

Signed-off-by: Paul Donald <redacted>
modules/luci-base/root/usr/share/rpcd/ucode/luci
modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js

index 26fd3b0e5b00ce271ccdb7578bc071b8d48ce047..de3ca20b8d099da8d83466d6c26131ea33d27b25 100644 (file)
@@ -196,6 +196,8 @@ const methods = {
                                firewall:   access('/sbin/fw3') == true,
                                firewall4:  access('/sbin/fw4') == true,
                                opkg:       access('/bin/opkg') == true,
+                               bonding:    access('/sys/module/bonding'),
+                               mii-tool:   access('/usr/sbin/mii-tool'),
                                offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true,
                                br2684ctl:  access('/usr/sbin/br2684ctl') == true,
                                swconfig:   access('/sbin/swconfig') == true,
index 4e664a800eda90bebdccb401e4c5ab203333ee9f..e7bfd59fdeeff4bdee3b37c29fd2001d373cbaa4 100644 (file)
@@ -450,10 +450,14 @@ return baseclass.extend({
                s.tab('brport', _('Bridge port specific options'));
                s.tab('bridgevlan', _('Bridge VLAN filtering'));
 
-               o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'));
+               o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'),
+                       !L.hasSystemFeature('bonding') && isNew ? '<a href="' + L.url("admin", "system", "package-manager", "?query=kmod-bonding") + '">'+
+                        _('For bonding, install %s').format('<code>kmod-bonding</code>') + '</a>' : null);
                o.readonly = !isNew;
                o.value('', _('Network device'));
-               o.value('bonding', _('Aggregation device'));
+               if (L.hasSystemFeature('bonding')) {
+                       o.value('bonding', _('Bonding/Aggregation device'));
+               }
                o.value('bridge', _('Bridge device'));
                o.value('8021q', _('VLAN (802.1q)'));
                o.value('8021ad', _('VLAN (802.1ad)'));
@@ -864,7 +868,9 @@ return baseclass.extend({
                };
                o.depends('type', 'bonding');
 
-               o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'));
+               o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'),
+                       !L.hasSystemFeature('mii-tool') ? '<a href="' + L.url("admin", "system", "package-manager", "?query=mii-tool") + '">'+
+                        _('Install %s').format('<code>mii-tool</code>') + '</a>' : null);
                o.default = '';
                o.value('arp', _('ARP link monitoring'));
                o.value('mii', _('MII link monitoring'));
git clone https://git.99rst.org/PROJECT