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 --- diff --git a/apps/Opie-SH/diskfree.desktop b/apps/Opie-SH/diskfree.desktop new file mode 100644 index 0000000..33a532c --- a/dev/null +++ b/apps/Opie-SH/diskfree.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=diskfree.sh +Icon=diskfree +Name=Disk Free diff --git a/apps/Opie-SH/filesystem_mounter.desktop b/apps/Opie-SH/filesystem_mounter.desktop new file mode 100644 index 0000000..673f738 --- a/dev/null +++ b/apps/Opie-SH/filesystem_mounter.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=filesystem_mounter.sh +Icon=fsmounter +Name=Filesystem Mounter diff --git a/apps/Opie-SH/hostlist.desktop b/apps/Opie-SH/hostlist.desktop new file mode 100644 index 0000000..4ec02ae --- a/dev/null +++ b/apps/Opie-SH/hostlist.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=hostlist +Exec=hostlist.sh +Icon=hostlist +Type=Application +Name=Hostlist diff --git a/apps/Opie-SH/killproc.desktop b/apps/Opie-SH/killproc.desktop new file mode 100644 index 0000000..b9b7d5e --- a/dev/null +++ b/apps/Opie-SH/killproc.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=killproc.sh +Icon=killproc +Name=Process Killer diff --git a/apps/Opie-SH/launcher_refresh.desktop b/apps/Opie-SH/launcher_refresh.desktop new file mode 100644 index 0000000..bce86a3 --- a/dev/null +++ b/apps/Opie-SH/launcher_refresh.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=launcher_refresh +Exec=launcher_refresh.sh +Icon=launcher_refresh +Type=Application +Name=Launcher Refresh diff --git a/apps/Opie-SH/logviewer.desktop b/apps/Opie-SH/logviewer.desktop new file mode 100644 index 0000000..dc87376 --- a/dev/null +++ b/apps/Opie-SH/logviewer.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=logviewer.sh +Icon=logviewer +Name=Log Viewer diff --git a/apps/Opie-SH/opie-sh-wavelanchooser.desktop b/apps/Opie-SH/opie-sh-wavelanchooser.desktop new file mode 100644 index 0000000..9162cda --- a/dev/null +++ b/apps/Opie-SH/opie-sh-wavelanchooser.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=WLAN Chooser +Exec=wavelanchooser.sh +Icon=qtwavelan +Type=Application +Name=WLAN Chooser diff --git a/apps/Opie-SH/rsyncme.desktop b/apps/Opie-SH/rsyncme.desktop new file mode 100644 index 0000000..288d233 --- a/dev/null +++ b/apps/Opie-SH/rsyncme.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Comment=rsync helper +Exec=rsyncme.sh +Icon=rsyncme +Type=Application +Name=RSYNC Helper diff --git a/apps/Opie-SH/service_manager.desktop b/apps/Opie-SH/service_manager.desktop new file mode 100644 index 0000000..4d4ef13 --- a/dev/null +++ b/apps/Opie-SH/service_manager.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=service_manager.sh +Icon=service_manager +Name=Service Manager diff --git a/apps/Opie-SH/usbnetctrl.desktop b/apps/Opie-SH/usbnetctrl.desktop new file mode 100644 index 0000000..a383f0c --- a/dev/null +++ b/apps/Opie-SH/usbnetctrl.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Type=Application +Exec=usbnetctrl.sh +Icon=usbnetctrl +Name=USBNET Control 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 diff --git a/pics/opie-sh-scripts/diskfree.png b/pics/opie-sh-scripts/diskfree.png new file mode 100644 index 0000000..8628710 --- a/dev/null +++ b/pics/opie-sh-scripts/diskfree.png Binary files differ diff --git a/pics/opie-sh-scripts/fsmounter.png b/pics/opie-sh-scripts/fsmounter.png new file mode 100644 index 0000000..c22f304 --- a/dev/null +++ b/pics/opie-sh-scripts/fsmounter.png Binary files differ diff --git a/pics/opie-sh-scripts/hostlist.png b/pics/opie-sh-scripts/hostlist.png new file mode 100644 index 0000000..e722d1a --- a/dev/null +++ b/pics/opie-sh-scripts/hostlist.png Binary files differ diff --git a/pics/opie-sh-scripts/killproc.png b/pics/opie-sh-scripts/killproc.png new file mode 100755 index 0000000..efb950c --- a/dev/null +++ b/pics/opie-sh-scripts/killproc.png Binary files differ diff --git a/pics/opie-sh-scripts/launcher_refresh.png b/pics/opie-sh-scripts/launcher_refresh.png new file mode 100644 index 0000000..0960e94 --- a/dev/null +++ b/pics/opie-sh-scripts/launcher_refresh.png Binary files differ diff --git a/pics/opie-sh-scripts/logviewer.png b/pics/opie-sh-scripts/logviewer.png new file mode 100644 index 0000000..d232213 --- a/dev/null +++ b/pics/opie-sh-scripts/logviewer.png Binary files differ diff --git a/pics/opie-sh-scripts/qtwavelan.png b/pics/opie-sh-scripts/qtwavelan.png new file mode 100644 index 0000000..1687437 --- a/dev/null +++ b/pics/opie-sh-scripts/qtwavelan.png Binary files differ diff --git a/pics/opie-sh-scripts/rsyncme.png b/pics/opie-sh-scripts/rsyncme.png new file mode 100644 index 0000000..862b143 --- a/dev/null +++ b/pics/opie-sh-scripts/rsyncme.png Binary files differ diff --git a/pics/opie-sh-scripts/service_manager.png b/pics/opie-sh-scripts/service_manager.png new file mode 100644 index 0000000..b4b3884 --- a/dev/null +++ b/pics/opie-sh-scripts/service_manager.png Binary files differ diff --git a/pics/opie-sh-scripts/usbnetctrl.png b/pics/opie-sh-scripts/usbnetctrl.png new file mode 100644 index 0000000..6227d9e --- a/dev/null +++ b/pics/opie-sh-scripts/usbnetctrl.png Binary files differ diff --git a/share/config/hostlist.cfg b/share/config/hostlist.cfg new file mode 100644 index 0000000..7ee0f9c --- a/dev/null +++ b/share/config/hostlist.cfg @@ -0,0 +1,2 @@ +www.handhelds.org +www.unknownhostwhichisneverup.dk diff --git a/share/config/rsyncme.cfg b/share/config/rsyncme.cfg new file mode 100644 index 0000000..2de9b77 --- a/dev/null +++ b/share/config/rsyncme.cfg @@ -0,0 +1,6 @@ +/tmp/ +/tmp/root/ +/root/ +/mnt/nfs/root/ +10.2.0.222:/root/ + -- cgit v0.9.0.2