fn_getopt 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. #!/bin/bash
  2. # LGSM fn_getopt function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 250515
  6. # Description: getopt arguments.
  7. fn_getopt_generic(){
  8. case "$getopt" in
  9. start)
  10. fn_start;;
  11. stop)
  12. fn_stop;;
  13. restart)
  14. fn_restart;;
  15. update)
  16. fn_update_check;;
  17. force-update)
  18. forceupdate=1;
  19. fn_update_check;;
  20. update-restart)
  21. forceupdate=1;
  22. fn_update_check;;
  23. update-functions)
  24. fn_update_functions;;
  25. validate)
  26. fn_validate;;
  27. monitor)
  28. fn_monitor;;
  29. email-test)
  30. fn_email_test;;
  31. details)
  32. fn_details;;
  33. backup)
  34. fn_backup;;
  35. console)
  36. fn_console;;
  37. debug)
  38. fn_debug;;
  39. install)
  40. fn_install;;
  41. auto-install)
  42. fn_autoinstall;;
  43. *)
  44. echo "Usage: $0 {start|stop|restart|update|force-update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install}"
  45. exit 1;;
  46. esac
  47. exit
  48. }
  49. fn_getopt_teamspeak3(){
  50. case "$getopt" in
  51. start)
  52. fn_start;;
  53. stop)
  54. fn_stop;;
  55. restart)
  56. fn_restart;;
  57. update)
  58. fn_update_check;;
  59. update-functions)
  60. fn_update_functions;;
  61. monitor)
  62. fn_monitor;;
  63. email-test)
  64. fn_email_test;;
  65. details)
  66. fn_details;;
  67. backup)
  68. fn_backup;;
  69. install)
  70. fn_install;;
  71. auto-install)
  72. fn_autoinstall;;
  73. *)
  74. echo "Usage: $0 {start|stop|restart|update|update-functions|monitor|email-test|details|backup|install|auto-install}"
  75. exit 1;;
  76. esac
  77. exit
  78. }
  79. fn_getopt_mumble(){
  80. case "$getopt" in
  81. start)
  82. fn_start;;
  83. stop)
  84. fn_stop;;
  85. restart)
  86. fn_restart;;
  87. update-functions)
  88. fn_update_functions;;
  89. monitor)
  90. fn_monitor;;
  91. email-test)
  92. fn_email_test;;
  93. backup)
  94. fn_backup;;
  95. console)
  96. fn_console;;
  97. debug)
  98. fn_debug;;
  99. *)
  100. echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|backup|console|debug}"
  101. exit 1;;
  102. esac
  103. exit
  104. }
  105. fn_getopt_unreal(){
  106. case "$getopt" in
  107. start)
  108. fn_start;;
  109. stop)
  110. fn_stop;;
  111. restart)
  112. fn_restart;;
  113. update-functions)
  114. fn_update_functions;;
  115. monitor)
  116. fn_monitor;;
  117. email-test)
  118. fn_email_test;;
  119. details)
  120. fn_details;;
  121. backup)
  122. fn_backup;;
  123. console)
  124. fn_console;;
  125. debug)
  126. fn_debug;;
  127. install)
  128. fn_install;;
  129. map-compressor)
  130. fn_compress_ut99maps;;
  131. *)
  132. echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  133. exit 1;;
  134. esac
  135. exit
  136. }
  137. fn_getopt_unreal2(){
  138. case "$getopt" in
  139. start)
  140. fn_start;;
  141. stop)
  142. fn_stop;;
  143. restart)
  144. fn_restart;;
  145. update)
  146. fn_update_check;;
  147. force-update)
  148. forceupdate=1;
  149. fn_update_check;;
  150. update-restart)
  151. forceupdate=1;
  152. fn_update_check;;
  153. update-functions)
  154. fn_update_functions;;
  155. validate)
  156. fn_validate;;
  157. monitor)
  158. fn_monitor;;
  159. email-test)
  160. fn_email_test;;
  161. details)
  162. fn_details;;
  163. backup)
  164. fn_backup;;
  165. console)
  166. fn_console;;
  167. debug)
  168. fn_debug;;
  169. install)
  170. fn_install;;
  171. auto-install)
  172. fn_autoinstall;;
  173. map-compressor)
  174. fn_compress_unreal2maps;;
  175. *)
  176. echo "Usage: $0 {start|stop|restart|update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  177. exit 1;;
  178. esac
  179. exit
  180. }
  181. fn_getopt_ut2k4(){
  182. case "$getopt" in
  183. start)
  184. fn_start;;
  185. stop)
  186. fn_stop;;
  187. restart)
  188. fn_restart;;
  189. update-functions)
  190. fn_update_functions;;
  191. monitor)
  192. fn_monitor;;
  193. email-test)
  194. fn_email_test;;
  195. details)
  196. fn_details;;
  197. backup)
  198. fn_backup;;
  199. console)
  200. fn_console;;
  201. debug)
  202. fn_debug;;
  203. install)
  204. fn_install;;
  205. map-compressor)
  206. fn_compress_unreal2maps;;
  207. *)
  208. echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  209. exit 1;;
  210. esac
  211. exit
  212. }
  213. if [ "${gamename}" == "Mumble" ]; then
  214. fn_getopt_mumble
  215. elif [ "${gamename}" == "Teamspeak 3" ]; then
  216. fn_getopt_teamspeak3
  217. elif [ "${engine}" == "unreal2" ]; then
  218. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  219. fn_getopt_ut2k4
  220. else
  221. fn_getopt_unreal2
  222. fi
  223. elif [ "${engine}" == "unreal" ]; then
  224. fn_getopt_unreal
  225. else
  226. fn_getopt_generic
  227. fi