<div dir="ltr"><div><div>Guillermo,<br><br></div>It's always best to use a custom package if you can. Modifying upstream leads to problems like this.<br><br>I don't think you'd need those changes in uci-defaults.sh. Instead, I think you should put your changes in your own uci-default, like 02_network, but your own. Use a number after 02, like 03_custom and put it in /etc/uci-defaults. It should run on first boot. As long as this uci-default script completes successfully, I think the change should occur and the script itself should be deleted so it doesn't run again.<br><br></div>Eric<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 26, 2016 at 6:19 PM, Guillermo Javier Nardoni <span dir="ltr"><<a href="mailto:guillermo@geryon.com.ar" target="_blank">guillermo@geryon.com.ar</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone,<br>
<br>
At first, I should say that I've been away a long time from openwrt-devel<br>
mailing list.<br>
<br>
I was using Barrier Braker 14.07 to build our custom firmware, usually for<br>
TP-Link WR740/741 v3/v4, but recently we have received TP-Link WR740 v5<br>
(a.k.a. 741 v5) so I figured out that Barrier Braker don't have support for<br>
it, at least not native one.<br>
Googling I found a solution which I've flashed it first with a stripped<br>
custom firmware found on Internet and then, via console, do a beautifull<br>
reflash with WR741 v4 firmware (build by us) and everything Works perfect!.<br>
<br>
Since I'm not the one who flashes the devices I did a new git from trunk<br>
versión of OpenWrt (CHAOS CALMER (15.05)) because it has native support for<br>
TP-Link TL-WR740N versión 5 but when I looked into the code I've figured<br>
out, again, that the code changed a lot since the BB 14.07 and I don't know<br>
how to adapt the custom configurations.<br>
<br>
The reason I changed those 2 files it is because of the users sometimes (i<br>
mean always) press the reset button and it won't allow us to remotely<br>
recofigure the device and to use one port of the switch to bridge it with<br>
the WAN port to use them just because we have ATAs devices that don't<br>
support NAT etc etc.<br>
When a user presses the reset button, it resets the device and configure it<br>
with a standard configuration which let the user to have Telephone (VoIP),<br>
Internet, Wifi and we can Access remotely to reconfigure it as I said<br>
before.<br>
<br>
On BB 14.07 I've just modified 2 files:<br>
./package/base-files/files/lib/functions/uci-defaults.sh<br>
...<br>
<br>
ucidef_add_switch() {<br>
        local name=$1<br>
        local reset=$2<br>
        local enable=$3<br>
        uci batch <<EOF<br>
add network switch<br>
set network.@switch[-1].name='$name'<br>
set network.@switch[-1].reset='$reset'<br>
set network.@switch[-1].enable_vlan='$enable'<br>
EOF<br>
}<br>
<br>
ucidef_add_switch_vlan() {<br>
        local device=$1<br>
        local vlan=$2<br>
        local ports=$3<br>
        local device_name=$4<br>
        uci batch <<EOF<br>
set network.$4=switch_vlan<br>
set network.$4.device='$device'<br>
set network.$4.vlan='$vlan'<br>
set network.$4.ports='$ports'<br>
<br>
EOF<br>
#add network switch_vlan<br>
#set network.$device_name.device='$device'<br>
#set network.$device_name.vlan='$vlan'<br>
#set network.$device_name.ports='$ports'<br>
}<br>
<br>
ucidef_add_switch_port() {<br>
        local device=$1<br>
        local port=$2<br>
        uci batch <<EOF<br>
add network switch_port<br>
set network.@switch_port[-1].device='$device'<br>
set network.@switch_port[-1].port='$port'<br>
EOF<br>
}<br>
<br>
And file:<br>
./target/linux/ar71xx/base-files/etc/uci-defaults/02_network<br>
<br>
ap121 |\<br>
ap121-mini |\<br>
ap96 |\<br>
airrouter |\<br>
dir-600-a1 |\<br>
dir-615-c1 |\<br>
dir-615-e1 |\<br>
dir-615-e4 |\<br>
hiwifi-hc6361 |\<br>
ja76pf |\<br>
mynet-n600 |\<br>
oolite |\<br>
rb-750 |\<br>
rb-751 |\<br>
tew-632brp |\<br>
tew-712br |\<br>
tl-mr3220 |\<br>
tl-mr3220-v2 |\<br>
tl-mr3420 |\<br>
tl-wdr3500 |\<br>
tl-wr741nd |\<br>
tl-wr741nd-v4 |\<br>
tl-wr841n-v7 |\<br>
tl-wr841n-v9 |\<br>
whr-g301n |\<br>
whr-hp-g300n |\<br>
whr-hp-gn |\<br>
wzr-hp-ag300h)<br>
        ucidef_set_interfaces_lan_wan "eth0.1" "eth1 eth0.2"<br>
        ucidef_add_switch "switch0" "1" "1"<br>
        ucidef_add_switch_vlan "switch0" "1" "1 3 4 0t" "eth0_1"<br>
        ucidef_add_switch_vlan "switch0" "2" "2 0t" "eth0_2"<br>
        ;;<br>
<br>
But in new trunk version I found those files but uci-defaults.sh uses json.<br>
Could you please lend me a hand?.<br>
<br>
Would it be a great idea to build a custom package insted of modify the<br>
"upstream" code?<br>
<br>
Thanks in advance.<br>
<br>
Best Regards,<br>
Guillermo Nardoni.<br>
_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Eric Schultz, Community Manager, prpl Foundation<br><a href="http://www.prplfoundation.org" target="_blank">http://www.prplfoundation.org</a><br><a href="mailto:eschultz@prplfoundation.org" target="_blank">eschultz@prplfoundation.org</a><br>cell: 920-539-0404<br>skype: ericschultzwi<br>@EricPrpl</div></div>
</div>