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.

106 lines
2.7 KiB

  1. dnl
  2. dnl Macros for creating the SysV init scripts with nice or raw output
  3. dnl
  4. dnl --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  5. dnl
  6. dnl This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  7. dnl Please add additional copyright information _after_ the line containing
  8. dnl the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  9. dnl the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  10. dnl
  11. dnl ROCK Linux: rock-src/package/base/sysvinit/init_macros.m4
  12. dnl ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  13. dnl
  14. dnl This program is free software; you can redistribute it and/or modify
  15. dnl it under the terms of the GNU General Public License as published by
  16. dnl the Free Software Foundation; either version 2 of the License, or
  17. dnl (at your option) any later version. A copy of the GNU General Public
  18. dnl License can be found at Documentation/COPYING.
  19. dnl
  20. dnl Many people helped and are helping developing ROCK Linux. Please
  21. dnl have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  22. dnl file for details.
  23. dnl
  24. dnl --- ROCK-COPYRIGHT-NOTE-END ---
  25. dnl
  26. divert(-1)
  27. initstyle = sysv_nice ....... Nice colored output
  28. initstyle = sysv_text ....... Raw text output
  29. ifelse(initstyle, `sysv_nice',
  30. `define(`IT', `dnl')
  31. define(`IN', `')'
  32. ,
  33. `define(`IT', `')
  34. define(`IN', `dnl')'
  35. )
  36. define(`this_is_not_the_first_option', `')
  37. define(`default_restart', ` restart)
  38. `$'0 stop; `$'0 start
  39. ;;
  40. ')
  41. ifelse(initstyle, `sysv_nice', `
  42. define(`main_begin', `title() {
  43. local x w="`$'( stty size 2>/dev/null </dev/tty | cut -d" " -f2 )"
  44. [ -z "`$'w" ] && w="`$'( stty size </dev/console | cut -d" " -f2 )"
  45. for (( x=1; x<w; x++ )) do echo -n .; done
  46. echo -e "\e[222G\e[3D v \r\e[36m`$'* \e[0m"
  47. error=0
  48. }
  49. status() {
  50. if [ `$'error -eq 0 ]
  51. then
  52. echo -e "\e[1A\e[222G\e[4D\e[32m :-)\e[0m"
  53. else
  54. echo -e "\e[1A\e[222G\e[4D\a\e[1;31m :-(\e[0m"
  55. fi
  56. }
  57. case "`$'1" in')
  58. ' , `
  59. define(`main_begin', `case "`$'1" in')
  60. ')
  61. define(`main_end', `default_restart *)
  62. echo "Usage: `$'0 { undivert(1) }"
  63. exit 1 ;;
  64. esac
  65. exit 0')
  66. ifelse(initstyle, `sysv_nice', `
  67. define(`echo_title', `ifelse(`$1', `', `define(`dostatus', 0)dnl', `define(`dostatus', 1) title "$1"')')
  68. define(`echo_status', `ifelse(dostatus, 1, ` status', `dnl')')
  69. define(`check', `ifelse(dostatus, 1, `$* || error=$?', `$*')')
  70. ' , `
  71. define(`echo_title', `ifelse(`$1', `', `dnl', ` echo "$1"')')
  72. define(`echo_status', `dnl')
  73. define(`check', `$*')
  74. ')
  75. define(`block_begin', `$1)
  76. divert(1)dnl
  77. this_is_not_the_first_option`$1'dnl
  78. define(`this_is_not_the_first_option',` | ')dnl
  79. define(`default_$1', `')dnl
  80. divert(0)dnl
  81. echo_title(`$2')')
  82. define(`block_split', `echo_status
  83. echo_title(`$1')')
  84. define(`block_end', `echo_status
  85. ;;')
  86. divert(0)dnl