diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/mamona/usbnet | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/mamona/usbnet')
-rw-r--r-- | recipes/mamona/usbnet/default/usbnet | 4 | ||||
-rw-r--r-- | recipes/mamona/usbnet/interfaces.usbnet | 5 | ||||
-rw-r--r-- | recipes/mamona/usbnet/usbnet | 113 |
3 files changed, 122 insertions, 0 deletions
diff --git a/recipes/mamona/usbnet/default/usbnet b/recipes/mamona/usbnet/default/usbnet new file mode 100644 index 0000000000..eeabaf9c70 --- /dev/null +++ b/recipes/mamona/usbnet/default/usbnet @@ -0,0 +1,4 @@ +# Defaults for usbnet initscript +# sourced by /etc/init.d/usbnet + +INTERFACE_CONF=/etc/network/interfaces.usbnet diff --git a/recipes/mamona/usbnet/interfaces.usbnet b/recipes/mamona/usbnet/interfaces.usbnet new file mode 100644 index 0000000000..86600d9c69 --- /dev/null +++ b/recipes/mamona/usbnet/interfaces.usbnet @@ -0,0 +1,5 @@ +iface usb0 inet static + address 10.0.1.10 + netmask 255.255.255.0 + broadcast 10.0.1.255 + up route add default gw 10.0.1.11 diff --git a/recipes/mamona/usbnet/usbnet b/recipes/mamona/usbnet/usbnet new file mode 100644 index 0000000000..6b0ac1c250 --- /dev/null +++ b/recipes/mamona/usbnet/usbnet @@ -0,0 +1,113 @@ +#!/bin/sh +# USB Networking script +# Copyright (C) 2007 INdT. +# @author Abner Jose de Faria Silva <abner.silva@indt.org.br> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +DESC="USB Networking" + +INITFSPATH=/mnt/initfs +MODULENAME="g_ether" +MODULEPATH=$INITFSPATH/lib/modules/$(uname -r)/$MODULENAME.ko +CONFIGPATH=/etc/default/usbnet + +MOUNTPOINT=/media/mmc + +LSMOD=/bin/lsmod +RMMOD=/sbin/rmmod +INSMOD=/sbin/insmod +IFUP=/sbin/ifup +IFDOWN=/sbin/ifdown + +test -e "$MODULEPATH" || exit 0 +test -x "$IFUP" || exit 0 +test -x "$IFDOWN" || exit 0 +test -x "$LSMOD" || exit 0 +test -x "$RMMOD" || exit 0 +test -x "$INSMOD" || exit 0 + +test -r "$CONFIGPATH" && . $CONFIGPATH + + +print_error() +{ + echo "failed." + echo "$1" +} + +start_usbnet() +{ + if $LSMOD | grep -q "$MODULENAME"; then + echo "$DESC is already configured." + return + fi + + echo -n "Starting $DESC: " + + for f in 1 2; do + umount "$MOUNTPOINT$f" > /dev/null 2>&1 + done + + if ! $INSMOD "$MODULEPATH" > /dev/null 2>&1; then + print_error "Error loading $MODULEPATH." + return + fi + + if ! $IFUP -i "$INTERFACE_CONF" usb0 > /dev/null 2>&1; then + print_error "Error configuring usb0." + return; + fi + + echo "done." +} + +stop_usbnet() +{ + echo -n "Stopping $DESC: " + + if ! $IFDOWN -i "$INTERFACE_CONF" usb0 > /dev/null 2>&1; then + print_error "Error deconfiguring usb0." + return; + fi + + if ! $RMMOD "$MODULENAME" > /dev/null 2>&1; then + print_error "Error unloading $MODULENAME" + return + fi + + echo "done." +} + +case "$1" in + start) + start_usbnet + ;; + stop) + stop_usbnet + ;; + restart|force-reload) + stop_usbnet + start_usbnet + ;; + *) + echo "Usage: $(basename $0) {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +echo "" + +exit 0 |