fn_getopt 3.9 KB

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