From cb6da268e3f4a6d110ea361ae2bd051fad3497d6 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 23 Sep 2010 05:31:19 +0200 Subject: [PATCH] indicator-network: add initscript, merge init script from connman and from busybox Signed-off-by: Stephan Raue --- packages/network/connman/init.d/13_connman | 39 ------------------- .../indicator-network/init.d/13_network} | 32 ++++++++++++--- 2 files changed, 27 insertions(+), 44 deletions(-) delete mode 100755 packages/network/connman/init.d/13_connman rename packages/{sysutils/busybox/init.d/09_network => network/indicator-network/init.d/13_network} (59%) diff --git a/packages/network/connman/init.d/13_connman b/packages/network/connman/init.d/13_connman deleted file mode 100755 index cdc4cfc0c3..0000000000 --- a/packages/network/connman/init.d/13_connman +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -################################################################################ -# Copyright (C) 2009-2010 OpenELEC.tv -# http://www.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, 675 Mass Ave, Cambridge, MA 02139, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -# start connman network manager -# -# runlevels: openelec, installer, textmode - -. /etc/profile - -progress "Starting Connection Manager" - - mkdir -p /var/run - touch /var/run/resolv.conf - -# requested by clandmeter: create symlink for tests - mkdir -p /var/lib/connman - ln -sf $HOME/.config/wifi.conf /var/lib/connman/wifi.conf - [ -f $HOME/network_test.sh ] && sh $HOME/network_test.sh - - connmand diff --git a/packages/sysutils/busybox/init.d/09_network b/packages/network/indicator-network/init.d/13_network similarity index 59% rename from packages/sysutils/busybox/init.d/09_network rename to packages/network/indicator-network/init.d/13_network index 275b320eaf..3afc943e0d 100755 --- a/packages/sysutils/busybox/init.d/09_network +++ b/packages/network/indicator-network/init.d/13_network @@ -20,21 +20,43 @@ # http://www.gnu.org/copyleft/gpl.html ################################################################################ -# -# start networking +# setup networking # # runlevels: openelec, installer, textmode . /etc/profile +HOSTNAME="openelec" # default hostname +NETWORK_TYPE="wired" # default network type +CONNECTION="dhcp" # default connection + +[ -f $HOME/.config/network.conf ] && . $HOME/.config/network.conf + # bring lo up, whether we have network card or not progress "starting Loopback Network interface" - ifconfig lo 127.0.0.1 up + ifconfig lo 127.0.0.1 up # setup hostname progress "Setup hostname" - echo "$HOSTNAME" > /proc/sys/kernel/hostname + echo "$HOSTNAME" > /proc/sys/kernel/hostname # create /etc/hosts file, useful for gethostbyname(localhost) progress "creating /etc/hosts" - echo -e "127.0.0.1\tlocalhost $HOSTNAME" > /etc/hosts + echo -e "127.0.0.1\tlocalhost $HOSTNAME" > /etc/hosts + +( + # starting Connection manager + progress "starting Connection manager" + + mkdir -p /var/run + touch /var/run/resolv.conf + [ -x /usr/sbin/connmand ] && /usr/sbin/connmand || exit 0 + + usleep 2000 + + if [ "$CONNECTION" = "dhcp" -a -x /usr/bin/cmcc ]; then + /usr/bin/cmcc edit Wired ipv4 dhcp + elif [ "$CONNECTION" = "static" -a -n "$IPADDRESS" -a -n "$NETMASK" -a -n "$GATEWAY" -a -x /usr/bin/cmcc ]; then + /usr/bin/cmcc edit Wired ipv4 manual "$IPADDRESS" "$NETMASK" "$GATEWAY" + fi +)& \ No newline at end of file