Italiano English
Modifica History Actions

NinuxUciScript

Ninux Uci Script

set -a

/etc/init.d/dnsmasq stop
/etc/init.d/dnsmasq disable

/etc/init.d/firewall stop
/etc/init.d/firewall disable

HOSTNAME="zioprotowrt"
WLANIP="172.16.40.3"
LANIP=192.168.1.1
LANNET=192.168.1.0
LANMASK=255.255.255.0
LANGW=""

CHANNEL="8"
ESSID="ninux.org"
BSSID="02:02:CA:FE:CA:FE"

sysctl -w kernel.hostname=$HOSTNAME
uci set system.@system[0].hostname=$HOSTNAME

DEVICE=`uci get wireless.@wifi-iface[0].device`
uci delete wireless.$DEVICE.disabled

#disable default bridge on lan
uci delete network.lan.type

#TODO: move this config to variables on top of script
uci set network.lan.proto=static
uci set network.lan.ipaddr=$LANIP
uci set network.lan.netmask=$LANMASK
uci set network.lan.gateway=$LANGW
uci set network.lan.dns=8.8.8.8

#TODO: move this config to variables on top of script
uci set network.wlan=interface
uci set network.wlan.proto=static
uci set network.wlan.ipaddr=$WLANIP
uci set network.wlan.netmask=255.255.0.0

uci set wireless.$DEVICE.channel=$CHANNEL
uci set wireless.$DEVICE.disabled=0
#uci set wireless.$DEVICE.txpower=20

uci set wireless.@wifi-iface[0].network=wlan
uci set wireless.@wifi-iface[0].mode=adhoc
uci set wireless.@wifi-iface[0].ssid=$ESSID
uci set wireless.@wifi-iface[0].encryption=none
uci set wireless.@wifi-iface[0].bgscan=0
uci set wireless.@wifi-iface[0].bssid=$BSSID
rm /etc/config/olsrd
touch /etc/config/olsrd
uci add olsrd olsrd
uci set olsrd.@olsrd[0].IpVersion=4
uci set olsrd.@olsrd[0].DebugLevel=0
uci add olsrd LoadPlugin
uci set olsrd.@LoadPlugin[0]=LoadPlugin
uci set olsrd.@LoadPlugin[0].library=olsrd_txtinfo.so.0.1
uci set olsrd.@LoadPlugin[0].accept="0.0.0.0"
uci add olsrd Interface
uci set olsrd.@Interface[0]=Interface
uci set olsrd.@Interface[0].interface=wlan
uci add olsrd Hna4
uci set olsrd.@Hna4[-1].netaddr=$LANNET
uci set olsrd.@Hna4[-1].netmask=$LANMASK
uci set olsrd.@LoadPlugin[0]=LoadPlugin
uci set olsrd.@LoadPlugin[0].library=olsrd_mdns.so.1.0.0
uci set olsrd.@LoadPlugin[0].NonOlsrIf=lan


uci commit

[ -x /etc/init.d/olsrd ] && /etc/init.d/olsrd enable