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.

107 lines
3.3 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/misc/output/mythtvosd/functions.sh
  9. # ROCK Linux is Copyright (C) 1998 - 2004 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. # first we will construct a universal 'say' function
  23. function send_proc() {
  24. while read line
  25. do
  26. while read -t1 subline; do
  27. line="$( echo -e "$line\\n$subline" | tail -n10 )"
  28. done
  29. $ROCKCFG_OUTPUT_MYTHTVOSD_BIN --template=misc/output/mythtvosd/rock.xml \
  30. --host="`hostname`" --msg="$line" 2>&1 > /dev/null
  31. done
  32. }
  33. function send() {
  34. if [ -z "$ROCK_OUPUT_PLUGIN_MYTHTVOSD_PROC_ACTIVE" ]; then
  35. export ROCK_OUPUT_PLUGIN_MYTHTVOSD_PROC_ACTIVE=1
  36. exec 198> >( send_proc )
  37. fi
  38. echo "$*" >&198
  39. }
  40. # A free-form header at start of a section usually followed by calls to
  41. # echo_status_terminal().
  42. #
  43. echo_header_mythtvosd() {
  44. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_HEADER -eq 1 ] && send "$*"
  45. }
  46. # A free-form status message informaing the user of what is happening just
  47. # now.
  48. #
  49. echo_status_mythtvosd() {
  50. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_STATUS -eq 1 ] && send "$*"
  51. }
  52. # A free-form error or warning message if something fails.
  53. #
  54. echo_error_mythtvosd() {
  55. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_ERROR -eq 1 ] && send "$*"
  56. }
  57. # We deny to build a package for some reason.
  58. #
  59. # Usage: echo_pkg_deny <stagelevel> <package-name> <reason>
  60. #
  61. echo_pkg_deny_mythtvosd() {
  62. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_PKG_DENY -eq 1 ] &&
  63. send `eval echo "$ROCKCFG_OUTPUT_MYTHTVOSD_TXT_PKG_DENY"`
  64. }
  65. # We start building a package.
  66. #
  67. # Usage: echo_pkg_start <stagelevel> <repository> <package-name> \
  68. # <ver> <extraver>
  69. #
  70. echo_pkg_start_mythtvosd() {
  71. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_PKG_START -eq 1 ] &&
  72. send `eval echo "$ROCKCFG_OUTPUT_MYTHTVOSD_TXT_PKG_START"`
  73. }
  74. # We finished building a package.
  75. #
  76. # Usage: echo_pkg_finish <stagelevel> <repository> <package-name>
  77. #
  78. echo_pkg_finish_mythtvosd() {
  79. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_PKG_FINISH -eq 1 ] &&
  80. send `eval echo "$ROCKCFG_OUTPUT_MYTHTVOSD_TXT_PKG_FINISH"`
  81. }
  82. # We aborted building a package.
  83. #
  84. # Usage: echo_pkg_abort <stagelevel> <repository> <package-name>
  85. #
  86. echo_pkg_abort_mythtvosd() {
  87. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_PKG_ABORT -eq 1 ] &&
  88. send `eval echo "$ROCKCFG_OUTPUT_MYTHTVOSD_TXT_PKG_ABORT"`
  89. }
  90. # Whenever the tail of error logs are printed, this function is used for
  91. # that. The parameter may contain newlines.
  92. #
  93. echo_errorquote_mythtvosd() {
  94. [ $ROCKCFG_OUTPUT_MYTHTVOSD_ENABLE_ERRORQUOTE -eq 1 ] &&
  95. send `eval echo "$ROCKCFG_OUTPUT_MYTHTVOSD_TXT_ERRORQUOTE"`
  96. }