implement 'wait for network'

This commit is contained in:
Stefan Saraev 2013-02-26 13:48:50 +02:00
parent d9e06bd4bd
commit 3d54e09252
5 changed files with 48 additions and 0 deletions

View File

@ -2,6 +2,8 @@
<setting id="LCD_DRIVER" value="none" />
<setting id="HDD_STANDBY" value="false" />
<setting id="HDD_STANDBY_TIME" value="15" />
<setting id="WAIT_NETWORK" value="false" />
<setting id="WAIT_NETWORK_TIME" value="10" />
<setting id="NET_DNS1" value="" />
<setting id="NET_DNS2" value="" />
<setting id="NET_DNS3" value="" />

View File

@ -13,6 +13,9 @@
<string id="2060">HDD standby</string>
<string id="2061">Enable HDD standby</string>
<string id="2062">HDD standby timeout (minutes)</string>
<string id="2070">Other</string>
<string id="2071">Wait for network before starting xbmc</string>
<string id="2072">Wait time (seconds)</string>
<!-- Network -->
<string id="2100">Network</string>

View File

@ -17,6 +17,10 @@
<setting type="sep" />
<setting id="HDD_STANDBY" type="bool" label="2061" default="false" />
<setting id="HDD_STANDBY_TIME" type="number" label="2062" default="15" visible="eq(-1,true)" />
<setting label="2070" type="lsep"/>
<setting type="sep" />
<setting id="WAIT_NETWORK" type="bool" label="2071" default="false" />
<setting id="WAIT_NETWORK_TIME" type="number" label="2072" default="10" visible="eq(-1,true)" />
</category>
<!-- Network -->

View File

@ -52,6 +52,9 @@ fi
# waiting for Xorg to start
wait_for_xorg
# wait for network
wait_for_inet_addr
# set cpu's to 'conservative'
( usleep 15000000
progress "set cpu's to 'ondemand'"

View File

@ -0,0 +1,36 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
wait_for_inet_addr () {
if [ -f /var/config/settings.conf ]; then
. /var/config/settings.conf
fi
if [ "$WAIT_NETWORK" = "true" ] ; then
progress "Wait for network"
[ -z "$WAIT_NETWORK_TIME" ] && WAIT_NETWORK_TIME=10
LOOP_COUNT=$[$WAIT_NETWORK_TIME * 5]
for i in $(seq 1 $LOOP_COUNT) ; do
cnt=$(ifconfig | sed -e '/inet addr:/!d' -e '/127.0.0.1/d' |wc -l)
[ $cnt -gt 0 ] && break
usleep 200000
done
fi
}