FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
159 views 1 comments
by anonymous

Hi all,

I'm trying to build the image (for RUT950) with some custom settings, build the image and upload the bin file to the router. I have managed to change most of the settings such as MQTT version, custom APNs, LAN IP, Modbus, WAN interfaces (priority), but I'm struggling with the wireless settings in the STA mode. 

I was thinking of creating a file with the WiFi networks (for the RUT950 to connect to) instead of adding something like (the one below) in the package/kernel/mac80211/files/lib/wifi/mac80211.sh

config wifi-iface
option device radio$devidx
option network wan
option user_enable '1'
option mode sta
option scan_sleep '10'
option ssid 'TEST'
option encryption 'psk-mixed'
option key 'testpass'

 So instead, I created a file in the package/base-files/files/etc/uci-defaults/99_wifi-sta with the following:

#!/bin/sh
sleep 45
 
# Disable WiFi AP
uci set wireless.@wifi-iface[0].disabled='1'
uci set wireless.@wifi-iface[0].user_enable='0'
 
# Add the first STA
uci add wireless wifi-iface
uci set wireless.@wifi-iface[1]='wifi-iface'
uci set wireless.@wifi-iface[1].network='wan'
uci set wireless.@wifi-iface[1].encryption='psk'
uci set wireless.@wifi-iface[1].device='radio0'
uci set wireless.@wifi-iface[1].key='testpass'
uci set wireless.@wifi-iface[1].user_enable='1'
uci set wireless.@wifi-iface[1].mode='sta'
uci set wireless.@wifi-iface[1].scan_sleep='10'
uci set wireless.@wifi-iface[1].ssid='TEST'
 
uci commit wireless
wifi reload
#sync
#/etc/init.d/network restart
 
exit 0

I set it as an executable and built the image. I can see the file exists in the /rom/etc/uci-defaults but the settings are not there but If I manually execute the script (i.e. ./rom/etc/uci-defaults/99_wifi-sta) everything works.
I feel that my script runs before the wireless pkgs are executed so it's overriden? I tried to add sleep but I'm not 100% sure whether that would block the execution of all scripts/pkgs following that or just that script. 

I can see some files in the rom directory that are executed after my script (e.g. teltonika etc), but I'm not entirely sure after which one should my script run. Is this the right directory to add my script (uci-defaults) or should it be a different one?

Thanks

by anonymous

I followed the custom-scripts and added the script file in the bin and updated the rc.local. All sorted now

1 Answer

0 votes
by anonymous

I followed the custom-scripts and added the script file in the bin and updated the rc.local. All sorted now.

Best answer