#!/bin/sh /etc/rc.common START=12 config_mode_iface=eth0 config_mode_addr=192.168.1.1 config_mode_plen=24 config_mode_dnsname=freifunk config_mode_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 config_mode 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("config_mode", "wizard", nil, { running = "1" }); uci_state:save("config_mode")' uci set 'config_mode.@wizard[0].enabled=0' uci commit config_mode ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface ip link set up dev $config_mode_iface /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 "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config_mode dnsmasq -h -H /tmp/hosts.config_mode -R -F interface:$config_mode_iface,$config_mode_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 }