mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.4 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/gpm/stone_mod_gpm.sh
  9. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. #
  23. # [MAIN] 40 gpm General Purpose Mouse (GPM) Daemon
  24. write_config() {
  25. cat << EOT > /etc/conf/gpm
  26. GPM_MOUSE="$GPM_MOUSE"
  27. GPM_ARGS="`echo -t $GPM_TYPE -$GPM_BUTTONS $GPM_ARGS`"
  28. EOT
  29. }
  30. set_port() {
  31. gui_menu gpm_port \
  32. "Select the mouse port. (Current: $GPM_MOUSE)" \
  33. 'All input layer events . /dev/input/mice' 'GPM_MOUSE=/dev/input/mice' \
  34. 'Input layer mouse 0 .... /dev/input/mouse0' 'GPM_MOUSE=/dev/input/mouse0' \
  35. 'Input layer mouse 1 .... /dev/input/mouse1' 'GPM_MOUSE=/dev/input/mouse1' \
  36. 'TTS 0 (aka COM 1) ...... /dev/tts/0' 'GPM_MOUSE=/dev/tts/0' \
  37. 'TTS 1 (aka COM 2) ...... /dev/tts/1' 'GPM_MOUSE=/dev/tts/1' \
  38. 'TTS 2 (aka COM 3) ...... /dev/tts/2' 'GPM_MOUSE=/dev/tts/2' \
  39. 'TTS 3 (aka COM 4) ...... /dev/tts/3' 'GPM_MOUSE=/dev/tts/3' \
  40. 'PSAUX (aka PS/2) ....... /dev/misc/psaux' 'GPM_MOUSE=/dev/misc/psaux' \
  41. 'SUNMOUSE (SBUS) ........ /dev/misc/sunmouse' 'GPM_MOUSE=/dev/misc/sunmouse'
  42. write_config
  43. }
  44. set_type() {
  45. cmd="gui_menu gpm_type 'Select the mouse type."
  46. cmd="$cmd (Current: $GPM_TYPE)'" ; x="'"
  47. while read type desc ; do
  48. cmd="$cmd '$type - ${desc//$x/$x\\$x$x}' 'GPM_TYPE=$type'"
  49. done < <( gpm -m $GPM_MOUSE -t help | grep '^[ \*] [^ ]' | cut -c3- )
  50. eval "$cmd" ; write_config
  51. }
  52. set_buttons() {
  53. gui_menu gpm_buttons \
  54. "Select the number of mouse buttons. (Current: $GPM_BUTTONS)" \
  55. 'This is a mouse with 2 buttons' 'GPM_BUTTONS=2' \
  56. 'This is a mouse with 3 buttons' 'GPM_BUTTONS=3'
  57. write_config
  58. }
  59. set_args() {
  60. gui_input "Extra options for the gpm daemon (Current: $GPM_ARGS)" \
  61. "$GPM_ARGS" "GPM_ARGS"
  62. write_config
  63. }
  64. main() {
  65. while
  66. GPM_MOUSE="/dev/misc/psaux" ; GPM_ARGS="-t ms -2"
  67. [ -f /etc/conf/gpm ] && . /etc/conf/gpm
  68. set -- $GPM_ARGS ; GPM_ARGS=""
  69. while [ "$1" ] ; do
  70. if [ "$1" = "-t" ] ; then
  71. GPM_TYPE="$2" ; shift
  72. elif [ -z "${1#-[23]}" ] ; then
  73. GPM_BUTTONS="${1#-}"
  74. else
  75. GPM_ARGS="$GPM_ARGS $1"
  76. fi
  77. shift
  78. done
  79. gui_menu gpm 'General Purpose Mouse (GPM) Daemon Configuration.
  80. Select an item to change the value:' \
  81. "Mouse Port ........ $GPM_MOUSE" 'set_port' \
  82. "Mouse Type ........ $GPM_TYPE" 'set_type' \
  83. "Mouse Buttons ..... $GPM_BUTTONS" 'set_buttons' \
  84. "Extra Options ..... $GPM_ARGS" 'set_args' \
  85. '' '' \
  86. 'Edit the /etc/conf/gpm file' \
  87. "gui_edit 'GPM Config File' /etc/conf/gpm" \
  88. 'Configure runlevels for GPM service' \
  89. '$STONE runlevel edit_srv gpm' \
  90. '(Re-)Start gpm init script' \
  91. '$STONE runlevel restart gpm'
  92. do : ; done
  93. }