# Generated for:
# kamikaze
# Avila GW2348-4
# radio: 11768-arcs_onlineRd1
#
# unsolclic version: 1.0
#
# TFTP method:
# Click here to download firmware OpenWRT Kamikaze file: .
#
# Web Browser method:
# Click here to download firmware OpenWRT Kamikaze file: .
# Put the mouse cursor over the link. Right click the link and select "Save Link/Target As..." to save to your Desktop.
#

#
#
# File /etc/config/wireless
echo "

## Radio: ArcsrcsnlnRd1AP0
config 'wifi-device' 'wifi0'
        option 'type' 'atheros'
        option 'channel' '0'
        option 'disabled' '0'
        option 'hwmode' '11b'
        option 'diversity' '0'
        option 'txantenna' '1'
        option 'rxantenna' '1'
        option 'txpower' '16'

config wifi-iface
        option 'device' 'wifi0'
        option 'network' 'lan'
        option 'agmode' 'ap'
        option 'ssid' 'guifi.net-ArcsrcsnlnRd1AP0'
        option 'encryption' 'none'

" > /etc/config/wireless 
#
#
# File /etc/config/network
echo "
config interface loopback
        option 'ifname'  'lo'
        option 'proto'    'static'
        option 'ipaddr'   '127.0.0.1'
        option 'netmask'  '255.0.0.0'


config interface lan
        option 'ifname'   'ath0 eth0'
        option 'type'     'bridge'
        option 'proto'    'static'
        option 'ipaddr'   '10.36.138.1'
        option 'netmask'  '255.255.255.224'
        option 'dns'      ''


" > /etc/config/network 
#
#
# File /etc/quagga/zebra.conf
echo "" > /etc/quagga/zebra.conf
#
#
# File /etc/config/firewall
echo "
config defaults
        option 'syn_flood' '1'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'ACCEPT'
        
config zone
        option 'name' 'lan'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'ACCEPT'

" > /etc/config/firewall
#
#
# File /etc/opkg.conf
echo "
src/gz snapshots http://downloads.openwrt.org/snapshots/ixp4xx/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /jffs
" > /etc/opkg.conf
#
# File /etc/config/luci_ethers
echo "" > /etc/config/luci_ethers
#
#
# File /etc/config/dhcp
echo "
config 'dnsmasq'
        option 'domainneeded' '1'
        option 'boguspriv' '1'
        option 'filterwin2k' '0'
        option 'localise_queries' '1'
        option 'local' '/lan/'
        option 'domain' 'lan'
        option 'expandhosts' '1'
        option 'nonegcache' '0'
        option 'authoritative' '1'
        option 'readethers' '1'
        option 'leasefile' '/tmp/dhcp.leases'
        option 'resolvfile' '/tmp/resolv.conf.auto'

 config 'dhcp' 'lan'
        option 'interface' 'lan'
        option 'leasetime' '12h'
        option 'start' '3'
        option 'limit' '27'
" > /etc/config/dhcp
#
#
# NTPClient Settings
COUNTER=0
while [  $COUNTER -lt 4 ]; do
 uci delete ntpclient.@ntpserver[0] > /dev/null 2>&1
  let COUNTER=COUNTER+1 
done
uci add ntpclient ntpserver
uci set ntpclient.@ntpserver[0]=ntpserver
uci set ntpclient.@ntpserver[0].hostname=
uci set ntpclient.@ntpserver[0].port=123
uci add ntpclient ntpserver
uci set ntpclient.@ntpserver[1]=ntpserver
uci set ntpclient.@ntpserver[1].hostname=
uci set ntpclient.@ntpserver[1].port=123
uci add ntpclient ntpserver
uci set ntpclient.@ntpserver[2]=ntpserver
uci set ntpclient.@ntpserver[2].hostname=1.openwrt.pool.ntp.org
uci set ntpclient.@ntpserver[2].port=123
uci set ntpclient.@ntpclient[0]=ntpclient
uci set ntpclient.@ntpclient[0].interval=60
uci set ntpclient.@ntpdrift[0]=ntpdrift
uci set ntpclient.@ntpdrift[0].freq=0
sleep 1
#
#
# System Settings
uci set system.@system[0]=system
uci set system.@system[0].hostname=arcs_onlineRd1
uci set system.@system[0].zonename=Europe/Andorra
uci set system.@system[0].timezone=CET-1CEST,M3.5.0,M10.5.0/3
uci delete system.@button[0]
uci delete system.@button[1]
uci add system button
uci set system.@button[0]=button
uci set system.@button[0].button=reset
uci set system.@button[0].action=released
uci set system.@button[0].handler="logger reboot"
uci set system.@button[0].min=0
uci set system.@button[0].max=4
uci add system button
uci set system.@button[1]=button
uci set system.@button[1].button=reset
uci set system.@button[1].action=released
uci set system.@button[1].handler="logger factory default"
uci set system.@button[1].min=5
uci set system.@button[1].max=30
sleep 1
#
#
# SNMP Settings
uci set snmpd.@system[0]=system
uci set snmpd.@system[0].sysLocation=arcs_online
uci set snmpd.@system[0].sysContact=compuarc@gmail.com
uci set snmpd.@system[0].sysName=guifi.net
uci set snmpd.@system[0].sysDescr="Xarxa Oberta, Lliure i Neutral"
sleep 1
#
#
# LLDP Settings
uci set lldpd.config=lldpd
uci set lldpd.config.enable_cdp=1
uci set lldpd.config.enable_fdp=1
uci set lldpd.config.enable_sonmp=1
uci set lldpd.config.enable_edp=1
uci set lldpd.config.lldp_class=4
uci set lldpd.config.lldp_location=2:ES:6:arcs_online:3:guifi.net:19:11768
sleep 1
#
#
# File /etc/passwd
cat > /etc/passwd << EOF 
root:WLL3bqv6fH7qM:0:0:root:/root:/bin/ash
nobody:*:65534:65534:nobody:/var:/bin/false
daemon:*:65534:65534:daemon:/var:/bin/false
quagga:x:51:51:quagga:/tmp/.quagga:/bin/false
EOF
sleep 1
#
# end of script and reboot
uci commit
reboot