#!/bin/sh /etc/rc.common START=12 configmode_iface=eth0 configmode_addr=192.168.1.1 configmode_plen=24 configmode_dnsname=freifunk configmode_dhcp_range=192.168.1.2,192.168.1.254 check_enable() { config_get enabled "$1" enabled config_get configured "$1" configured if [ "$enabled" = 1 -o "$configured" != 1 ]; then export enable=1 fi } start() { enable=0 config_load configmode config_foreach check_enable wizard if [ "$enable" = '1' ]; then lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("configmode", "wizard", nil, { running = "1" }); uci_state:save("configmode")' uci set 'configmode.@wizard[0].enabled=0' uci commit configmode ip addr add $configmode_addr/$configmode_plen dev $configmode_iface ip link set up dev $configmode_iface /etc/init.d/haveged start /etc/init.d/telnet start /etc/init.d/dropbear start /etc/init.d/uhttpd start /etc/init.d/led start # correctly finish firstboot /etc/init.d/done boot echo "$configmode_addr $configmode_dnsname" > /tmp/hosts.configmode dnsmasq -h -H /tmp/hosts.configmode -R -F interface:$configmode_iface,$configmode_dhcp_range -l /tmp/dhcp.leases -O option:router . /etc/diag.sh get_status_led status_led_set_timer 1000 300 # block further boot while true; do sleep 1; done fi }