fn_getopt 4.0 KB

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