56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
Bash
Executable File
#!/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 gluon-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("gluon-config-mode", "wizard", nil, { running = "1" }); uci_state:save("gluon-config-mode")'
|
|
uci set 'gluon-config-mode.@wizard[0].enabled=0'
|
|
uci commit gluon-config-mode
|
|
|
|
ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface
|
|
ip link set up dev $config_mode_iface
|
|
|
|
/usr/sbin/telnetd -l /lib/gluon/config-mode/ash-login
|
|
/etc/init.d/dropbear start
|
|
|
|
/usr/sbin/uhttpd -h /lib/gluon/config-mode/www -x /cgi-bin -A 1 -R -p 0.0.0.0:80
|
|
|
|
/etc/init.d/led start
|
|
|
|
# correctly finish firstboot
|
|
/etc/init.d/done boot
|
|
|
|
echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.gluon-config-mode
|
|
dnsmasq -h -H /tmp/hosts.gluon-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
|
|
}
|