Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.52 KB | None | 0 0
  1. commit 82b70b2c290091684c6b940b4a563e5d71140b71
  2. Author: Kiall Mac Innes <kiall@managedit.ie>
  3. Date:   Mon Jan 31 01:11:19 2011 +0000
  4.  
  5.     Initial Support for debconf selections. Not all common settings are available yet.
  6.  
  7. diff --git a/ext/debian/mcollective.config b/ext/debian/mcollective.config
  8. new file mode 100755
  9. index 0000000..1bcc33f
  10. --- /dev/null
  11. +++ b/ext/debian/mcollective.config
  12. @@ -0,0 +1,74 @@
  13. +#!/bin/bash -e
  14. +
  15. +# Source debconf library.
  16. +. /usr/share/debconf/confmodule
  17. +
  18. +# Stomp Questions
  19. +db_input medium mcollective/plugin_stomp_host || true
  20. +db_go
  21. +
  22. +db_input medium mcollective/plugin_stomp_port || true
  23. +db_go
  24. +
  25. +db_input medium mcollective/plugin_stomp_user || true
  26. +db_go
  27. +
  28. +db_input medium mcollective/plugin_stomp_password || true
  29. +db_go
  30. +
  31. +# Security Questions
  32. +db_input medium mcollective/securityprovider || true
  33. +db_go
  34. +
  35. +db_get mcollective/securityprovider
  36. +
  37. +SECURITY_PROVIDER=$RET
  38. +
  39. +if [ "$SECURITY_PROVIDER" == "psk" ]; then
  40. +   db_input medium mcollective/plugin_psk || true
  41. +   db_go
  42. +fi
  43. +
  44. +if [ "$SECURITY_PROVIDER" == "ssl" ]; then
  45. +   # No Extra Questions Needed
  46. +   # TODO: Make this show some info on the next steps for setting up SSL auth
  47. +   break
  48. +fi
  49. +
  50. +if [ "$SECURITY_PROVIDER" == "aes" ]; then
  51. +   # No Extra Questions Needed
  52. +   # TODO: Make this show some info on the next steps for setting up AES auth
  53. +   break
  54. +fi
  55. +
  56. +# Logging Questions
  57. +db_input medium mcollective/loggertype || true
  58. +db_go
  59. +
  60. +db_get mcollective/loggertype
  61. +
  62. +LOGGER_TYPE=$RET
  63. +
  64. +if [ "$LOGGER_TYPE" == "file" ]; then
  65. +   db_input medium mcollective/logfile || true
  66. +   db_go
  67. +
  68. +   db_input medium mcollective/keeplogs || true
  69. +   db_go
  70. +
  71. +   db_input medium mcollective/max_log_size || true
  72. +   db_go
  73. +fi
  74. +
  75. +if [ "$LOGGER_TYPE" == "syslog" ]; then
  76. +   # No Extra Questions Needed
  77. +   break
  78. +fi
  79. +
  80. +if [ "$LOGGER_TYPE" == "console" ]; then
  81. +   # No Extra Questions Needed
  82. +   break
  83. +fi
  84. +
  85. +db_input medium mcollective/loglevel || true
  86. +db_go
  87. diff --git a/ext/debian/mcollective.postinst b/ext/debian/mcollective.postinst
  88. new file mode 100755
  89. index 0000000..73033c9
  90. --- /dev/null
  91. +++ b/ext/debian/mcollective.postinst
  92. @@ -0,0 +1,81 @@
  93. +#!/bin/bash -e
  94. +
  95. +# Source debconf library.
  96. +. /usr/share/debconf/confmodule
  97. +
  98. +replace_or_add () {
  99. +   # $1 = Config Setting Name
  100. +   # $2 = New value
  101. +   local CFG_NAME=`sed -e 's/\(\/\|\\\|&\)/\\&/g' <<< $1`
  102. +   local CFG_VALUE=`sed -e 's/\(\/\|\\\|&\)/\\&/g' <<< $2`
  103. +#  local CFG_NAME=$1
  104. +#  local CFG_VALUE=$2
  105. +
  106. +   sed -i -e "/^\($CFG_NAME[[:blank:]]*=[[:blank:]]*\).*/!ba" -e "s//$CFG_VALUE/" -e h -e b -e :a -e '$!b' -e p -e g -e '/./d' -e "s/.*/$CFG_NAME = $CFG_VALUE/" /etc/mcollective/server.cfg
  107. +}
  108. +
  109. +# Stomp Questions
  110. +db_get mcollective/plugin_stomp_host
  111. +replace_or_add "plugin.stomp.host" "$RET"
  112. +
  113. +db_get mcollective/plugin_stomp_port
  114. +replace_or_add "plugin.stomp.port" "$RET"
  115. +
  116. +db_get mcollective/plugin_stomp_user
  117. +replace_or_add "plugin.stomp.user" "$RET"
  118. +
  119. +db_get mcollective/plugin_stomp_password
  120. +replace_or_add "plugin.stomp.password" "$RET"
  121. +
  122. +# Security Questions
  123. +db_get mcollective/securityprovider
  124. +replace_or_add "securityprovider" "$RET"
  125. +
  126. +SECURITY_PROVIDER=$RET
  127. +
  128. +if [ "$SECURITY_PROVIDER" == "psk" ]; then
  129. +   db_get mcollective/plugin_psk
  130. +   replace_or_add "plugin.psk" "$RET"
  131. +fi
  132. +
  133. +if [ "$SECURITY_PROVIDER" == "ssl" ]; then
  134. +   # Do Nothing for the moment!
  135. +   break
  136. +fi
  137. +
  138. +if [ "$SECURITY_PROVIDER" == "aes" ]; then
  139. +   # Do Nothing for the moment!
  140. +   break
  141. +fi
  142. +
  143. +# Logging Questions
  144. +db_get mcollective/loggertype
  145. +replace_or_add "loggertype" "$RET"
  146. +
  147. +LOGGER_TYPE=$RET
  148. +
  149. +if [ "$LOGGER_TYPE" == "file" ]; then
  150. +   db_get mcollective/logfile
  151. +   replace_or_add "logfile" "$RET"
  152. +
  153. +   db_get mcollective/keeplogs
  154. +   replace_or_add "keeplogs" "$RET"
  155. +
  156. +   db_get mcollective/max_log_size
  157. +   replace_or_add "max_log_size" "$RET"
  158. +fi
  159. +
  160. +if [ "$LOGGER_TYPE" == "syslog" ]; then
  161. +   # Do Nothing for the moment!
  162. +   break
  163. +fi
  164. +
  165. +if [ "$LOGGER_TYPE" == "console" ]; then
  166. +   # Do Nothing for the moment!
  167. +   break
  168. +fi
  169. +
  170. +db_get mcollective/loglevel
  171. +replace_or_add "loglevel" "$RET"
  172. +
  173. +
  174. diff --git a/ext/debian/templates b/ext/debian/templates
  175. new file mode 100644
  176. index 0000000..7dc2ad1
  177. --- /dev/null
  178. +++ b/ext/debian/templates
  179. @@ -0,0 +1,58 @@
  180. +Template: mcollective/plugin_stomp_host
  181. +Type: string
  182. +Default: stomp.example.com
  183. +Description: Stomp host:
  184. +
  185. +Template: mcollective/plugin_stomp_port
  186. +Type: string
  187. +Default: 6163
  188. +Description: Stomp port:
  189. +
  190. +Template: mcollective/plugin_stomp_user
  191. +Type: string
  192. +Default: mcollective
  193. +Description: Stomp username:
  194. +
  195. +Template: mcollective/plugin_stomp_password
  196. +Type: string
  197. +Default: marionette
  198. +Description: Stomp password:
  199. +
  200. +Template: mcollective/securityprovider
  201. +Type: select
  202. +Default: psk
  203. +Choices: psk, ssl, aes
  204. +Description: Security Provider:
  205. +
  206. +Template: mcollective/plugin_psk
  207. +Type: string
  208. +Default: marionette
  209. +Description: Pre-Shared Key (for use with the PSK Security Provider):
  210. +
  211. +Template: mcollective/loggertype
  212. +Type: select
  213. +Default: syslog
  214. +Choices: file, syslog, console
  215. +Description: Logger Type:
  216. +
  217. +Template: mcollective/logfile
  218. +Type: string
  219. +Default: /var/log/mcollective.log
  220. +Description: Logger File:
  221. +
  222. +Template: mcollective/keeplogs
  223. +Type: string
  224. +Default: 5
  225. +Description: Keep Logs:
  226. +
  227. +Template: mcollective/max_log_size
  228. +Type: string
  229. +Default: 2097152
  230. +Description: Max Log Size:
  231. +
  232. +Template: mcollective/loglevel
  233. +Type: select
  234. +Default: warn
  235. +Choices: info, warn, debug, fatal, error
  236. +Description: Log Level:
  237. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement