#!/bin/sh #--------------------------------------------------------------------- # # MUG is Maemo by/for Uber-Geeks - a collection of tools and # utilities for the Nokia770 by Uber-Geeks.com # # mug usbnet v0.1 [2005feb15] # # Unless otherwise documented in the code, this software # has been released under the GNU General Public License # and is copyright mug@uber-geeks.com. # # More information about the GPL can be found on the GNU website. # # All of this software is considered to be "stable". However, # it is always a good idea to test and/or review code before # relying on it. There is no warranty for this code beyond what # is required by the GPL. # # usage usbnet [start|stop|restart|status] # # author mug@uber-geeks.com # #--------------------------------------------------------------------- # USAGE () { # echo "usage function" echo echo "mug-usbnet v0.1 [2005Feb15] GPL2" echo echo "enables / disables the USB network" echo "interface on the Nokia 770" echo echo " usage: $0 {start|stop|restart|status}" echo } START () { # echo "start function" if ! lsmod | grep g_ether 1> /dev/null ; then echo "insmod g_ether.ko" /sbin/insmod /mnt/initfs/lib/modules/`uname -r`/g_ether.ko fi if ! ifconfig | grep usb0 1> /dev/null ; then echo "ifup usb0" /sbin/ifup usb0 fi } # STOP () { # echo "stop function" if ifconfig | grep usb0 1> /dev/null ; then echo "ifdown usb0" /sbin/ifdown usb0 fi if lsmod | grep g_ether 1> /dev/null ; then echo "rmmod g_ether" /sbin/rmmod g_ether fi } STATUS () { # echo "status function" if lsmod | grep g_ether 1> /dev/null ; then echo "g_ether module loaded" else echo "g_ether module unloaded"; fi if ifconfig | grep usb0 1> /dev/null ; then echo "interface usb0 up" else echo "interface usb0 down"; fi } # case $1 in start) START ;; stop) STOP ;; status) STATUS ;; restart) STOP START ;; *) USAGE ;; esac