OpenWrt Forum Archive

Topic: UCI commands; scripting

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am a beginner and need support.
On this page AROK's trunk builds  everyone can download a build for his router.

arokh wrote:

...To keep settings without breakage, you can create a script using UCI commands that you run after upgrading.

I need help for such a script. Maybe someone has already a script that it provides?

regards
Rosi

Here's the script I use in my builds. Maybe you can reuse some of that smile

#!/bin/sh

uci batch <<EOF

set system.@system[0].zonename='Europe/Oslo'
set system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
set system.@system[0].log_size='64'
set system.@system[0].cronloglevel='9'

set network.vpn='interface'
set network.vpn.proto='none'
set network.vpn.ifname='tun0'

set network.tor='interface'
set network.tor.proto='static'
set network.tor.ipaddr='192.168.2.1'
set network.tor.netmask='255.255.255.0'

delete dhcp.@dnsmasq[0].resolvfile
set dhcp.@dnsmasq[0].dnssec='0'
set dhcp.@dnsmasq[0].noresolv='1'
set dnscrypt-proxy.@dnscrypt-proxy[0].resolver='opendns'
add_list dhcp.@dnsmasq[0].addnhosts='/etc/hosts.block'
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
add_list dhcp.@dnsmasq[0].server='/0.openwrt.pool.ntp.org/8.8.8.8'
add_list dhcp.@dnsmasq[0].server='/1.openwrt.pool.ntp.org/8.8.8.8'
add_list dhcp.@dnsmasq[0].server='/2.openwrt.pool.ntp.org/8.8.8.8'
add_list dhcp.@dnsmasq[0].server='/3.openwrt.pool.ntp.org/8.8.8.8'

set dhcp.tor='dhcp'
set dhcp.tor.interface='tor'
set dhcp.tor.start='100'
set dhcp.tor.limit='150'
set dhcp.tor.leasetime='12h'

set uhttpd.pixelserv='uhttpd'
set uhttpd.pixelserv.listen_http='81'
set uhttpd.pixelserv.home='/www_blank'
set uhttpd.pixelserv.error_page='/blank.gif'

set wireless.@wifi-device[0].country='00'
set wireless.@wifi-device[0].disabled='0'
set wireless.@wifi-device[0].log_level='3'

set wireless.@wifi-iface[0].encryption='psk2'
set wireless.@wifi-iface[0].key='changeme'
set wireless.@wifi-iface[0].wps_pushbutton='0'

set wireless.@wifi-device[1].country='00'
set wireless.@wifi-device[1].disabled='0'
set wireless.@wifi-device[1].log_level='3'

set wireless.@wifi-iface[1].encryption='psk2'
set wireless.@wifi-iface[1].key='changeme'
set wireless.@wifi-iface[1].wps_pushbutton='0'

set wireless.tor='wifi-iface'
set wireless.tor.network='tor'
set wireless.tor.mode='ap'
set wireless.tor.ssid='OpenWrt Tor'
set wireless.tor.encryption='psk2'
set wireless.tor.key='changeme'
set wireless.tor.disabled='1'

commit
EOF

Thanks.

Rosi

The discussion might have continued from here.