From dfac71239116c4804081d925e9cf3021680b1e2c Mon Sep 17 00:00:00 2001 From: spiralman Date: Sun, 01 Sep 2002 14:42:39 +0000 Subject: initial import of gonz's opie-sh scripts --- (limited to 'noncore') diff --git a/noncore/tools/opie-sh/scripts/diskfree.sh b/noncore/tools/opie-sh/scripts/diskfree.sh new file mode 100755 index 0000000..6fcd709 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/diskfree.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# diskfree.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-5 - bugfix +# 20020524-1 - initial release + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh + +# there must be a better way to do this with sed, but i had no time +# time to look into this yet... + +( echo "" + echo "

diskfree

how much space is left ?
" + echo "

" + + df -Ph \ + | grep -v "Mounted on" \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed "s/ / /g" \ + | cut -d " " -f4- \ + | sed 's/ /<\/td>
/g' \ + | sed 's/$/<\/td><\/tr>/' \ + | sed 's/^/
/' ; echo "
" \ +) | $OPIE_SH -t "Space left" -f + +rm -f /tmp/qcop-msg-diskfree.sh diff --git a/noncore/tools/opie-sh/scripts/filesystem_mounter.sh b/noncore/tools/opie-sh/scripts/filesystem_mounter.sh new file mode 100755 index 0000000..faaf37c --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/filesystem_mounter.sh @@ -0,0 +1,126 @@ +#!/bin/sh + +# filesystem_mounter.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-2 - using df from diskfree now +# 20020524-1 - just code optix +# 20020519-1 - added information screen with manpage excerpt, added +# better returncode-checking +# 20020517-2 - fixed output bug +# 20020517-1 - nicer fullscreen, added about, tried icon +# + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh + +###################################################################### +# subroutines + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it possible for you to " + echo "easily mount and unmount filesystems from /etc/fstab" + echo "

" + ) | $OPIE_SH -t fsmounter -f & + SCREENCLEAN=$! + sleep 1 +} + +beforemount() { + ( echo "" + echo "

mount or unmount $MOUNTPOINT ?

" + echo "excerpt from MOUNT(8) manpage:

" + echo "All files accessible in a Unix system are arranged in one + big tree, the file hierarchy, rooted at /. These files + can be spread out over several devices. The mount command + serves to attach the file system found on some device to + the big file tree. Conversely, the umount(8) command will + detach it again." + echo "

" + ) | $OPIE_SH -t fsmounter -f & + SCREENCLEAN2=$! + sleep 1 +} + + +cleanup() { + kill $SCREENCLEAN $SCREENCLEAN2 + rm -f /tmp/qcop-msg-filesystem_mounter.sh +} + +get_action() { +# ask what to do (start/stop/status) +# +$OPIE_SH -m -t "Select Action" \ + -M "action for $MOUNTPOINT ?" \ + -g -0 mount -1 umount +RETURNCODE=$? + +case $RETURNCODE in + -1|255) echo unexpected input detected, exiting. | $OPIE_SH -f + cleanup ;; + 0) ACTION=mount ;; + 1) ACTION=umount ;; +esac +kill $SCREENCLEAN2 +} + +select_mountpoint() { +# present service list and choose +# +MOUNTPOINT=` cat /etc/fstab | cut -f1 \ + | cut -d " " -f1 \ + | egrep -v "(tmpfs|proc|devpts|^#)" \ + | $OPIE_SH -i -l \ + -g -t "SELECT MOUNTPOINT" \ + -L "select fs: " ` +} + +###################################################################### +# main + +about +select_mountpoint +beforemount +get_action + +if [ "$MOUNTPOINT" = "" ] +then echo "ugly error...." | $OPIE_SH -f ; cleanup +fi + +( echo "" + echo "

Output of $ACTION $MOUNTPOINT :

" + echo "
"
+  $ACTION $MOUNTPOINT  2>&1
+  echo "

" + echo "

diskfree

how much space is left ?
" + echo "

" + + df -Ph \ + | grep -v "Mounted on" \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed 's/ / /g' \ + | sed "s/ / /g" \ + | cut -d " " -f4- \ + | sed 's/ /<\/td>
/g' \ + | sed 's/$/<\/td><\/tr>/' \ + | sed 's/^/
/' ; echo "
" \ +) | $OPIE_SH -f + +cleanup diff --git a/noncore/tools/opie-sh/scripts/hostlist.sh b/noncore/tools/opie-sh/scripts/hostlist.sh new file mode 100755 index 0000000..6575e9c --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/hostlist.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +# hostlist.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-1 - icon to hostlist +# 20020517-1 - added icon, changed name in launcher +# + +CFG=/opt/QtPalmtop/share/config/hostlist.cfg +OPIE_SH=opie-sh + +hostlist() { +( echo "" + echo "

Hostlist


" + HOSTLIST=`cat $CFG` + for HOST in $HOSTLIST + do + PT=` ping -c1 $HOST | grep avg|cut -d " " -f4-` + if [ "$PT" != "" ] + then echo " " + echo "$HOST is up
[$PT]
" + else echo " " + echo "$HOST is down
[$PT]
" + fi + done +) | $OPIE_SH -t "Which are up ?" -f + + +} + +cleanup() { + kill $SCREENCLEAN + rm -f /tmp/qcop-msg-hostlist.sh +} + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it possible for you to " + echo "check some hosts for availability." + echo "

" + ) | $OPIE_SH -t hostlist -f & + SCREENCLEAN=$! + sleep 1 +} + +##################################################################### +# +# main + +about + +# ask to: start or edit list +$OPIE_SH -m -g -t Hostlist -M "Welcome!" -0 Start -1 "Edit Hostlist" +RETURNCODE=$? +case $RETURNCODE in +-1) echo died unexpectedly... | $OPIE_SH -f + cleanup + exit ;; +1) textedit $CFG + cleanup ;; +0) if [ -f $CFG ] + then hostlist + else echo www,handhelds.org >$CFG ; hostlist + fi + cleanup + ;; +esac diff --git a/noncore/tools/opie-sh/scripts/killproc.sh b/noncore/tools/opie-sh/scripts/killproc.sh new file mode 100755 index 0000000..8afb4b8 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/killproc.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +# killproc.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-1 - code optix +# 20020519-1 - added icon to output +# 20020517-1 - nicer fullscreen, added about, tried icon + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh + +###################################################################### +# subroutines + +about() { + ( echo "" + echo "

About

" + echo "This little util sends the TERM signal " + echo "to the specified process or process group. " + echo "The TERM signal will kill processes which " + echo "do not catch this signal. " + echo "

" + ) | $OPIE_SH -t opie-killproc -f & + SCREENCLEAN=$! + sleep 1 +} + +cleanup() { + kill $SCREENCLEAN + rm -f /tmp/qcop-msg-killproc.sh +} + +select_process() { + # present process list and choose + # + PROCESS=`ps -eaf | cut -b 10-15,40- \ + | cut -b -40 \ + | grep -v "TIME CMD" \ + | $OPIE_SH -i -l -g \ + -t "Select Process" ` +} + +###################################################################### +# main + +about +select_process + +PROCESS=`echo $PROCESS | cut -b -4` + + +( echo "" + echo "

Output of kill $PROCESS

" + echo "
"
+  kill $PROCESS 2>&1
+  echo "

" + echo done. +) | $OPIE_SH -f + +cleanup diff --git a/noncore/tools/opie-sh/scripts/launcher_refresh.sh b/noncore/tools/opie-sh/scripts/launcher_refresh.sh new file mode 100755 index 0000000..7850508 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/launcher_refresh.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# launcher_refresh.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. + +OPIE_SH=opie-sh + +launcher_refresh() { +( echo "" + echo "

Refresh successful!


" + echo the launcher has been refreshed. + echo + echo this is useful if you installed packages using ipk instead of + echo oipkg. it is also helping if you are changing .desktop-files + echo often. + echo "

" it also refreshes the input-methods. +) | $OPIE_SH -t "launcher-refresh" -f +} + +cleanup() { + rm -f /tmp/qcop-msg-launcher_refresh.sh +} + +##################################################################### +# +# main + +/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()" +#/opt/QtPalmtop/bin/qcop QPE/System "restart()" +/opt/QtPalmtop/bin/qcop QPE/System "linkChanged(QString)" + +launcher_refresh +cleanup diff --git a/noncore/tools/opie-sh/scripts/logviewer.sh b/noncore/tools/opie-sh/scripts/logviewer.sh new file mode 100755 index 0000000..e9657b4 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/logviewer.sh @@ -0,0 +1,116 @@ +#!/bin/sh + +# logviewer.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020526-1a - initial release... +# + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh +INITPATH=/etc/init.d + +###################################################################### +# subroutines + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it possible for you to " + echo "easily have a look at some of the syslogs. " + echo "

" + ) | $OPIE_SH -t logviewer -f & + SCREENCLEAN=$! + sleep 1 +} + +cleanup() { + kill $SCREENCLEAN 2>/dev/null + rm -f /tmp/qcop-msg-logviewer.sh +} + +choose_log() { + # ask what to do (start/stop/status) + # + $OPIE_SH -m -t "Select Log" \ + -M "which logfile are you interested in ?
" \ + -g -0 "PROC" -1 "SYSLOG" + RETURNCODE=$? + + case $RETURNCODE in + -1) echo unexpected input detected, exiting. + cleanup ;; + 0) LOGMETHOD=proc ;; + 1) LOGMETHOD=syslog ;; + esac +} + +###################################################################### +# main + +about +choose_log + +case $LOGMETHOD in + proc) $OPIE_SH -m -t "Select Log" \ + -M "which procfile ?
" \ + -g -0 kmsg -1 "ksyms" + RETURNCODE=$? + case $RETURNCODE in + -1) cleanup ;; + 0) + +cat /proc/kmsg >/tmp/log.$$ & +PID=$! +sleep 2 +kill $PID +( echo "" + echo "

/proc/kmsg

" + cat /tmp/log.$$ +) | $OPIE_SH -t kmsg -f +rm -f /tmp/$$ +cleanup ;; + + 1) + +cat /proc/ksyms >/tmp/log.$$ & +PID=$! +sleep 2 +kill $PID +( echo "" + echo "

/proc/ksyms

" + cat /tmp/log.$$ +) | $OPIE_SH -t ksyms -f +rm -f /tmp/$$ +cleanup ;; + + *) cleanup ;; + esac + cleanup ;; + + syslog) + +if [ -f /var/log/messages ] +then + $OPIE_SH -t syslog -f /var/log/messages +else + echo "no syslogd installed or /var/log/messages inexistent." \ + | $OPIE_SH -t syslog -f +fi +;; + *) cleanup ;; + esac + + +cleanup + diff --git a/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.sh b/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.sh new file mode 100755 index 0000000..13a1e79 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/opie-sh-wavelanchooser.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +# wavelanchooser.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020528-1 - fixed filename in cleanup +# 20020526-1 - rudimental but working +# 20020524-1 - initial working release planned +# + +OPIE_SH=opie-sh + +about() { + ( echo "" + echo "

About

" + echo "This little App is for changing the location setting" + echo "for your wireless card.
" + echo "actually it only starts /etc/init.d/[home|work] and can" + echo "be easily turned into a quick program to start the service" + echo "or init script you use most." + echo "

" + ) | $OPIE_SH -t wavelanchooser -f & + SCREENCLEAN=$! + sleep 1 +} + +cleanup() { + kill $SCREENCLEAN $SCREENCLEAN2 + rm -f /tmp/qcop-msg-opie-sh-wavelanchooser.sh +} + + +about + +# choose if work or home +$OPIE_SH -m -t "network-settings dialog" \ + -M "which configuration do you want ? " \ + -w -0 home -1 work -g + +if [ "$?" = "0" ] +then DECISION=home +else DECISION=work +fi + +( echo "you decided to choose $DECISION configuration. " + echo "remember to reinsert card." + /etc/init.d/$DECISION start +) | $OPIE_SH -t "confirmation" -f \ + + +cleanup diff --git a/noncore/tools/opie-sh/scripts/rsyncme.sh b/noncore/tools/opie-sh/scripts/rsyncme.sh new file mode 100755 index 0000000..c09aea8 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/rsyncme.sh @@ -0,0 +1,109 @@ +#!/bin/sh + +# rsyncme.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020517-1 - added icon, changed name in launcher +# + +CFG=/opt/QtPalmtop/share/config/rsyncme.cfg +OPIE_SH=opie-sh + +update_cfg() { + # check if dir is in CFG and if not add it + if [ "`grep -c $DIR $CFG`" = "0" ] + then echo $DIR >>$CFG + fi +} + +ask_dirs() { + # get source and destination dir + DIR=`$OPIE_SH -g -i -t "Choose Source Directory" -l -L DIR: -E -F $CFG ` + update_cfg + SRCDIR=$DIR + + DIR=`$OPIE_SH -g -i -t "Choose Destination Directory" -l -L DIR: -E -F $CFG ` + update_cfg + DESTDIR=$DIR +} + +ask_options() { + # now ask for options + OPTIONS="--archive --verbose --checksum --recursive --update --links --partial --dry-run --rsh=ssh --existing --compress --recursive" + OUTPUT=`( for OPTION in $OPTIONS + do + echo "$OPTION" + done ) | $OPIE_SH -t "Select options" -g -i -b -F ` +} + +rsync_output() { + ( echo "

Output of your rsync:

" + echo "command: rsync $OUTPUT $SRCDIR $DESTDIR" + echo "
"
+	  rsync $OUTPUT $SRCDIR $DESTDIR 2>&1
+	  echo "
done." + ) | $OPIE_SH -t "Result:" -f +} + +cleanup() { + kill $SCREENCLEAN + rm -f /tmp/qcop-msg-rsyncme.sh +} + +show_dirs() { + ( echo "

Directorys chosen for sync:

" + echo "" ) \ + | $OPIE_SH -t "Got directories" -f +} + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it possible for you to " + echo "easily choose the wanted options for an rsync process." + echo "

" + ) | $OPIE_SH -t rsync-helper -f & + SCREENCLEAN=$! + sleep 1 +} + + + + +##################################################################### +# +# main + +about + +# ask to: start rsync, edit dirlist, show about +$OPIE_SH -m -g -t RsyncMe -M "Welcome!" -0 Start -1 Dirlist +RETURNCODE=$? +case $RETURNCODE in +-1) echo died unexpectedly... | $OPIE_SH -f + cleanup + exit ;; +1) textedit $CFG + cleanup ;; +0) if [ -f $CFG ] + then ask_dirs + show_dirs + ask_options + rsync_output + else ( echo no config file seems to exist - see About... ) \ + | $OPIE_SH -t "SORRY..." -f + fi + cleanup + ;; +esac diff --git a/noncore/tools/opie-sh/scripts/service_manager.sh b/noncore/tools/opie-sh/scripts/service_manager.sh new file mode 100755 index 0000000..d1423a5 --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/service_manager.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +# service_manager.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-1 - added icon to statusinfo... +# 20020518-1 - optix +# 20020517-1 - added about and fullscreen +# + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh +INITPATH=/etc/init.d + +###################################################################### +# subroutines + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it possible for you to " + echo "easily start and stop services in /etc/init.d." + echo "

" + ) | $OPIE_SH -t service-manager -f & + SCREENCLEAN=$! + sleep 1 +} + +cleanup() { + kill $SCREENCLEAN + rm -f /tmp/qcop-msg-service_manager.sh +} + +get_action() { + # ask what to do (start/stop/status) + # + $OPIE_SH -m -t "Select Action" \ + -M "which action do you want to do to $SERVICE ?
" \ + -g -0 start -1 stop -2 status + RETURNCODE=$? + + case $RETURNCODE in + -1) echo unexpected input detected, exiting. + exit ;; + 0) ACTION=start ;; + 1) ACTION=stop ;; + 2) ACTION=status ;; + esac +} + +status_disclaimer() { + # tell that init scripts are not too standard + # + cat | $OPIE_SH -f < +

status has been disabled

+ + the status service has been disabled + because it is not supported by the + most init scripts that come with + familiar ...

+ + perhaps it will be replaced with + something more useful in the future... +EOT +} + +select_service() { + # present service list and choose + # + cd $INITPATH/ + SERVICE=` ls -1 | $OPIE_SH -i -l \ + -g -t "Select Service" \ + ` + cd - +} + +###################################################################### +# main + +about +select_service +get_action + +if [ "$SERVICE" = "" ] +then cleanup ; exit +fi + +if [ "$ACTION" = "status" ] +then status_disclaimer +else ( echo "

Output of $INITPATH/$SERVICE $ACTION:

" + echo "
"
+          $INITPATH/$SERVICE $ACTION
+          echo "

" + echo done. + ) | $OPIE_SH -f +fi + +cleanup + diff --git a/noncore/tools/opie-sh/scripts/usbnetctrl.sh b/noncore/tools/opie-sh/scripts/usbnetctrl.sh new file mode 100755 index 0000000..a12f74b --- a/dev/null +++ b/noncore/tools/opie-sh/scripts/usbnetctrl.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# usbnetctrl.sh - a demonstration of opie-sh +# +# Copyright (C) 2002 gonz@directbox.com +# +# 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. +# +# 20020524-1 - code beautification, added icons and reset +# 20020517-2 - bugfixed fullscreen, added info about ifconfig +# 20020517-1 - added about, fullscreen and icon + +OPIE_SH=/opt/QtPalmtop/bin/opie-sh + +###################################################################### +# subroutines + +about() { + ( echo "" + echo "

About

" + echo "This little App should make it easy for you to " + echo "activate / deactivate the usbnet-driver (on ipaq)" + echo "

" + echo "To use it at first, you need to change the ifconfig" + echo "line in /opt/QtPalmtop/bin/usbnetctrl.sh." + ) | $OPIE_SH -t "usbnet control" -f & + SCREENCLEAN=$! + sleep 1 +} + +startup() { + ( echo "" + echo "

usbnet up

" + modprobe usb-eth + + ifconfig usbf 10.3.0.226 netmask 255.255.255.0 \ + broadcast 10.3.0.255 + + ) 2>&1 | $OPIE_SH -t Output -f + if [ -f /root/masq.sh ] + then sh /root/masq.sh + fi +} + +stopit() { + ( echo "" + echo "

usbnet down

" + ifconfig usbf down + sleep 1 + rmmod usb-eth + rmmod sa1100usb_core + ) 2>&1 | $OPIE_SH -t Output -f +} + + +cleanup() { + kill $SCREENCLEAN + rm -f /tmp/qcop-msg-usbnetctrl.sh +} + + +yesorno() { + $OPIE_SH -m -t "USB-Net start/stop" -M "What to do with usbnet: " \ + -g -0 Start -1 Stop -2 Restart + RETURNCODE=$? + + case $RETURNCODE in + -1) echo error... + cleanup + exit ;; + 0) startup ;; + 1) stopit ;; + 2) stopit ; sleep 1 ; startup ;; + esac +} + +###################################################################### +# main + +about +yesorno +cleanup -- cgit v0.9.0.2