openwrtv3/package/base-files/files/lib/preinit/10_indicate_preinit
John Crispin 019ea725aa add "preinit_regular" diag.sh set_state argument
This new argument is used right after starting regular preinit (which
happens if failsafe wasn't triggered). The main purpose of "preinit"
argument is to indicate that failsafe can be triggered, however we were
missing a way to inform user that we don't wait for a trigger anymore.
With this change it's clear when failsafe mode can be triggered.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 43715
2014-12-15 10:37:00 +00:00

45 lines
1 KiB
Bash

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
preinit_ip() {
# if the preinit interface isn't specified and ifname is set in
# preinit.arch use that interface
if [ -z "$pi_ifname" ]; then
pi_ifname=$ifname
fi
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
}
}
preinit_ip_deconfig() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
ifconfig $pi_ifname 0.0.0.0 down
}
}
preinit_net_echo() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
{
[ "$pi_preinit_net_messages" = "y" ] || {
[ "$pi_failsafe_net_message" = "true" ] &&
[ "$pi_preinit_no_failsafe_netmsg" != "y" ]
}
} && netmsg $pi_broadcast "$1"
}
}
preinit_echo() {
preinit_net_echo $1
echo $1
}
pi_indicate_preinit() {
preinit_net_echo "Doing OpenWrt Preinit\n"
set_state preinit
}
boot_hook_add preinit_main preinit_ip
boot_hook_add preinit_main pi_indicate_preinit