fn_getopt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. #!/bin/bash
  2. # LGSM fn_getopt function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 301015
  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_gmodserver(){
  112. case "$getopt" in
  113. start)
  114. fn_start;;
  115. stop)
  116. fn_stop;;
  117. restart)
  118. fn_restart;;
  119. update)
  120. fn_update_check;;
  121. force-update)
  122. forceupdate=1;
  123. fn_update_check;;
  124. update-restart)
  125. forceupdate=1;
  126. fn_update_check;;
  127. update-functions)
  128. fn_update_functions;;
  129. validate)
  130. fn_validate;;
  131. monitor)
  132. fn_monitor;;
  133. email-test)
  134. fn_email_test;;
  135. details)
  136. fn_details;;
  137. backup)
  138. fn_backup;;
  139. console)
  140. fn_console;;
  141. debug)
  142. fn_debug;;
  143. install)
  144. fn_install;;
  145. auto-install)
  146. fn_autoinstall;;
  147. content)
  148. fn_content_gmod;;
  149. depsdetect)
  150. fn_deps_detect;;
  151. *)
  152. echo "Usage: $0 {start|stop|restart|update|force-update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|content}"
  153. exit 1;;
  154. esac
  155. exit
  156. }
  157. fn_getopt_unreal(){
  158. case "$getopt" in
  159. start)
  160. fn_start;;
  161. stop)
  162. fn_stop;;
  163. restart)
  164. fn_restart;;
  165. update-functions)
  166. fn_update_functions;;
  167. monitor)
  168. fn_monitor;;
  169. email-test)
  170. fn_email_test;;
  171. details)
  172. fn_details;;
  173. backup)
  174. fn_backup;;
  175. console)
  176. fn_console;;
  177. debug)
  178. fn_debug;;
  179. install)
  180. fn_install;;
  181. map-compressor)
  182. fn_compress_ut99maps;;
  183. depsdetect)
  184. fn_deps_detect;;
  185. *)
  186. echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  187. exit 1;;
  188. esac
  189. exit
  190. }
  191. fn_getopt_unreal2(){
  192. case "$getopt" in
  193. start)
  194. fn_start;;
  195. stop)
  196. fn_stop;;
  197. restart)
  198. fn_restart;;
  199. update)
  200. fn_update_check;;
  201. force-update)
  202. forceupdate=1;
  203. fn_update_check;;
  204. update-restart)
  205. forceupdate=1;
  206. fn_update_check;;
  207. update-functions)
  208. fn_update_functions;;
  209. validate)
  210. fn_validate;;
  211. monitor)
  212. fn_monitor;;
  213. email-test)
  214. fn_email_test;;
  215. details)
  216. fn_details;;
  217. backup)
  218. fn_backup;;
  219. console)
  220. fn_console;;
  221. debug)
  222. fn_debug;;
  223. install)
  224. fn_install;;
  225. auto-install)
  226. fn_autoinstall;;
  227. map-compressor)
  228. fn_compress_unreal2maps;;
  229. depsdetect)
  230. fn_deps_detect;;
  231. *)
  232. echo "Usage: $0 {start|stop|restart|update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  233. exit 1;;
  234. esac
  235. exit
  236. }
  237. fn_getopt_ut2k4(){
  238. case "$getopt" in
  239. start)
  240. fn_start;;
  241. stop)
  242. fn_stop;;
  243. restart)
  244. fn_restart;;
  245. update-functions)
  246. fn_update_functions;;
  247. monitor)
  248. fn_monitor;;
  249. email-test)
  250. fn_email_test;;
  251. details)
  252. fn_details;;
  253. backup)
  254. fn_backup;;
  255. console)
  256. fn_console;;
  257. debug)
  258. fn_debug;;
  259. install)
  260. fn_install;;
  261. map-compressor)
  262. fn_compress_unreal2maps;;
  263. depsdetect)
  264. fn_deps_detect;;
  265. *)
  266. echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  267. exit 1;;
  268. esac
  269. exit
  270. }
  271. if [ "${gamename}" == "Mumble" ]; then
  272. fn_getopt_mumble
  273. elif [ "${gamename}" == "Teamspeak 3" ]; then
  274. fn_getopt_teamspeak3
  275. elif [ "${engine}" == "unreal2" ]; then
  276. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  277. fn_getopt_ut2k4
  278. else
  279. fn_getopt_unreal2
  280. fi
  281. elif [ "${engine}" == "unreal" ]; then
  282. fn_getopt_unreal
  283. elif [ "$gamename" == "Garry's Mod" ]; then
  284. fn_getopt_gmodserver
  285. else
  286. fn_getopt_generic
  287. fi