launcher 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. #!/bin/bash
  2. #set -x
  3. ###
  4. #
  5. # Author: Stéphane HUC
  6. # mail: devs@stephane-huc.net
  7. #
  8. # License: BSD Simplified
  9. #
  10. # Github: https://git.framasoft.org/hucste/HostME
  11. #
  12. # Date: 2016/04/17
  13. #
  14. ###
  15. EXEC=true
  16. if ! ${EXEC}; then exit 1; fi
  17. ###
  18. # Launcher Menu HostME
  19. ##
  20. clear
  21. pwd="$(pwd)"
  22. # variables needed
  23. . "${pwd}/config/vars"
  24. #colors
  25. . "${pwd}/config/colors"
  26. # variables for displaying messages
  27. . "${pwd}/config/mssg"
  28. . "${pwd}/scripts/display"
  29. . "${pwd}/scripts/system"
  30. verify_need_softs
  31. ##########
  32. ### Functions
  33. ##########
  34. function launch_menu() {
  35. detect_uid
  36. . "${pwd}/scripts/mng_menu"
  37. main_menu
  38. }
  39. function launcher() {
  40. detect_pwd
  41. #if [[ ${NB_PARAMS} -eq 0 ]]; then
  42. #launch_menu
  43. #. "${pwd}/scripts/create_vhosts"
  44. #. "${pwd}/scripts/mng_ssl"
  45. #. "${pwd}/scripts/mng_ssh"
  46. #. "${pwd}/scripts/mng_headers"
  47. #create_vhost
  48. #else
  49. case "${MENU_CHOICE}" in
  50. create)
  51. launch_menu
  52. . "${pwd}/scripts/create_vhosts"
  53. . "${pwd}/scripts/mng_ssl"
  54. . "${pwd}/scripts/mng_ssh"
  55. . "${pwd}/scripts/mng_headers"
  56. create_vhost
  57. ;;
  58. delete)
  59. . "${pwd}/scripts/delete_vhosts"
  60. launch_menu
  61. delete_domain
  62. ;;
  63. help)
  64. display_help
  65. ;;
  66. restart)
  67. case "${MENU_OPTION}" in
  68. "php"|"web")
  69. detect_uid
  70. restart_server "${MENU_OPTION}"
  71. ;;
  72. *)
  73. display_bad_launcher
  74. display_help
  75. ;;
  76. esac
  77. ;;
  78. ssl)
  79. detect_uid
  80. . "${pwd}/scripts/mng_menu"
  81. . "${pwd}/scripts/mng_ssl"
  82. case "${MENU_OPTION}" in
  83. "create"|"new")
  84. main_menu
  85. use_ssl
  86. ;;
  87. "cron")
  88. # menu "${MENU_ARG}"
  89. main_menu
  90. ssl_cron
  91. ;;
  92. "final")
  93. main_menu
  94. finalize_ssl
  95. ;;
  96. "renew")
  97. main_menu
  98. ssl_renew
  99. ;;
  100. *)
  101. display_bad_launcher
  102. display_help
  103. ;;
  104. esac
  105. ;;
  106. test)
  107. # ajouter test zone
  108. case "${MENU_OPTION}" in
  109. "cfg")
  110. case "${MENU_ARG}" in
  111. "php"|"web")
  112. test_cfg "${MENU_ARG}"
  113. ;;
  114. *)
  115. display_bad_launcher
  116. display_help
  117. ;;
  118. esac
  119. ;;
  120. "child")
  121. launch_menu
  122. optimize_max_childs
  123. ;;
  124. "domain")
  125. . "${pwd}/scripts/mng_menu"
  126. main_menu
  127. test_conn_domain "${PARAMS[3]}"
  128. ;;
  129. "mem")
  130. case "${MENU_ARG}" in
  131. "php"|"web")
  132. check_memory_usage "${MENU_ARG}"
  133. ;;
  134. *)
  135. display_bad_launcher
  136. display_help
  137. ;;
  138. esac
  139. ;;
  140. "ocsp")
  141. . "${pwd}/scripts/mng_menu"
  142. main_menu
  143. . "${pwd}/scripts/mng_ssl"
  144. test_ocsp_stapling
  145. ;;
  146. *)
  147. display_bad_launcher
  148. display_help
  149. ;;
  150. esac
  151. ;;
  152. view)
  153. . "${pwd}/scripts/mng_menu"
  154. case "${MENU_OPTION}" in
  155. "cfg")
  156. case "${MENU_ARG}" in
  157. "php"|"web")
  158. main_menu
  159. display_cfg "${MENU_ARG}"
  160. ;;
  161. *)
  162. display_bad_launcher
  163. display_help
  164. ;;
  165. esac
  166. ;;
  167. "log")
  168. case "${MENU_ARG}" in
  169. "php"|"web")
  170. main_menu
  171. view_log "${MENU_ARG}"
  172. ;;
  173. *)
  174. display_bad_launcher
  175. display_help
  176. ;;
  177. esac
  178. ;;
  179. *)
  180. display_bad_launcher
  181. display_help
  182. ;;
  183. esac
  184. ;;
  185. *)
  186. display_bad_launcher
  187. ;;
  188. esac
  189. #fi
  190. }
  191. launcher