summaryrefslogtreecommitdiff
path: root/packages/mamona
diff options
context:
space:
mode:
authorRodrigo Vivi <rodrigo.vivi@gmail.com>2008-03-25 05:49:03 +0000
committerRodrigo Vivi <rodrigo.vivi@gmail.com>2008-03-25 05:49:03 +0000
commit971166d30bed349d585d12864a9a04d97b9db21e (patch)
tree42370a14677bc1f8149b6f468b1400f9c2684613 /packages/mamona
parent3fb22061e1bfc96e58862a6cf774cbd3f2784fa9 (diff)
Adding Usbnet package.
Usbnet is a package used by Mamona to setup network through usb.
Diffstat (limited to 'packages/mamona')
-rw-r--r--packages/mamona/.mtn2git_empty0
-rw-r--r--packages/mamona/usbnet/.mtn2git_empty0
-rw-r--r--packages/mamona/usbnet/default/.mtn2git_empty0
-rw-r--r--packages/mamona/usbnet/default/usbnet4
-rw-r--r--packages/mamona/usbnet/interfaces.usbnet5
-rw-r--r--packages/mamona/usbnet/usbnet113
-rw-r--r--packages/mamona/usbnet_0.1.0.bb38
7 files changed, 160 insertions, 0 deletions
diff --git a/packages/mamona/.mtn2git_empty b/packages/mamona/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/mamona/.mtn2git_empty
diff --git a/packages/mamona/usbnet/.mtn2git_empty b/packages/mamona/usbnet/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/mamona/usbnet/.mtn2git_empty
diff --git a/packages/mamona/usbnet/default/.mtn2git_empty b/packages/mamona/usbnet/default/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/mamona/usbnet/default/.mtn2git_empty
diff --git a/packages/mamona/usbnet/default/usbnet b/packages/mamona/usbnet/default/usbnet
new file mode 100644
index 0000000000..eeabaf9c70
--- /dev/null
+++ b/packages/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/packages/mamona/usbnet/interfaces.usbnet b/packages/mamona/usbnet/interfaces.usbnet
new file mode 100644
index 0000000000..86600d9c69
--- /dev/null
+++ b/packages/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/packages/mamona/usbnet/usbnet b/packages/mamona/usbnet/usbnet
new file mode 100644
index 0000000000..6b0ac1c250
--- /dev/null
+++ b/packages/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
diff --git a/packages/mamona/usbnet_0.1.0.bb b/packages/mamona/usbnet_0.1.0.bb
new file mode 100644
index 0000000000..37c4189082
--- /dev/null
+++ b/packages/mamona/usbnet_0.1.0.bb
@@ -0,0 +1,38 @@
+DESCRIPTION = "USB Networking"
+HOMEPAGE = "http://dev.openbossa.org/trac/mamona/"
+SECTION = "utils"
+LICENSE = "GPL"
+RDEPENDS = "module-init-tools busybox"
+PR = "r1"
+
+PACKAGES = "${PN}"
+
+SRC_URI = "file://usbnet \
+ file://default/usbnet \
+ file://interfaces.usbnet"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "usbnet"
+INITSCRIPT_PARAMS = "defaults"
+
+# Skipping...
+do_configure () {
+}
+
+# Skipping...
+do_stage () {
+}
+
+# Skipping...
+do_compile () {
+}
+
+do_install () {
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/default
+ install -d ${D}${sysconfdir}/network
+ install -m 0755 ${WORKDIR}/usbnet ${D}${sysconfdir}/init.d
+ install -m 0644 ${WORKDIR}/default/usbnet ${D}${sysconfdir}/default
+ install -m 0644 ${WORKDIR}/interfaces.usbnet ${D}${sysconfdir}/network
+}