home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / bin / gnome-at-mobility < prev    next >
Text File  |  2010-05-11  |  2KB  |  102 lines

  1. #!/bin/sh
  2. #
  3. #  Copyright 2006 IBM Corp.
  4. #
  5. #  This program is free software; you can redistribute it and/or modify
  6. #  it under the terms of version 2 of the GNU General Public License
  7. #  as published by the Free Software Foundation
  8. #
  9. #  This program is distributed in the hope that it will be useful,
  10. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. #  GNU General Public License for more details.
  13. #
  14. #  You should have received a copy of the GNU General Public License
  15. #  along with this program; if not, write to the Free Software
  16. #  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  17. #
  18. ###############################################################################
  19. #
  20. #  NOTE: This script is intended to be run from the command line,
  21. #  GNOME menu, or from the desktop autostart.
  22. #
  23. #  /usr/bin/gnome-at-visual
  24. #  /usr/bin/gnome-at-mobility
  25. #
  26. #  If the "-s" flag is used then it is assumed to have been invoked
  27. #  from /usr/share/gnome/autostart/, and the first AT flagged
  28. #  to "startup" from GCONF_ALL will be executed.
  29. #
  30.  
  31. USAGE="$0 [-s]"
  32. GCONF_PATH=/desktop/gnome/applications/at
  33. GCONF_VISUAL="visual"
  34. GCONF_MOBILITY="mobility"
  35. GCONF_ALL="$GCONF_VISUAL $GCONF_MOBILITY"
  36.  
  37. run_at() {
  38.     CMDLINE=`gconftool-2 --get $GCONF_PATH/$1/exec`
  39.     if [ $? -ne 0 ]; then
  40.         exit $?
  41.     fi
  42.  
  43.     if [ -z "$CMDLINE" ]; then
  44.         exit 2
  45.     fi
  46.  
  47.     STARTUP=`gconftool-2 --get $GCONF_PATH/$1/startup`
  48.     if [ $? -ne 0 ]; then
  49.         exit $?
  50.     fi
  51.  
  52.     if [ ! -z "$AUTOSTART" ]; then
  53.         # assuming ran from /usr/share/gnome/autostart
  54.         if [ "x$STARTUP" = "xtrue" ]; then
  55.             # gconf indicated requested autostart
  56.             ($CMDLINE &)
  57.         fi
  58.     else
  59.         # run from command line or desktop menu
  60.         ($CMDLINE &)
  61.     fi
  62. }
  63.  
  64. case `basename $0` in
  65.     gnome-at-visual )
  66.         AT=$GCONF_VISUAL
  67.         ;;
  68.     gnome-at-mobility )
  69.         AT=$GCONF_MOBILITY
  70.         ;;
  71.     gnome-at-session | * )
  72.         AUTOSTART="yes"
  73.         AT=$GCONF_ALL
  74.         ;;
  75. esac
  76.  
  77. while getopts "s" options; do
  78.     case $options in
  79.         s )    AUTOSTART="yes"
  80.             AT=$GCONF_ALL
  81.             shift
  82.             ;;
  83.         \? )    echo $USAGE
  84.             exit 1
  85.             ;;
  86.         * )    echo $USAGE
  87.             exit 1
  88.             ;;
  89.     esac
  90. done
  91.  
  92. if [ $# -ne 0 ]; then
  93.     echo $USAGE
  94.     exit 1
  95. fi
  96.  
  97. for I in $AT ; do
  98.     run_at $I
  99. done
  100.  
  101. #EOF
  102.