fn_getopt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #!/bin/bash
  2. # LGSM fn_getopt function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 190515
  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-funtions|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. *)
  70. echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup}"
  71. exit 1;;
  72. esac
  73. exit
  74. }
  75. fn_getopt_unreal(){
  76. case "$getopt" in
  77. start)
  78. fn_start;;
  79. stop)
  80. fn_stop;;
  81. restart)
  82. fn_restart;;
  83. update-functions)
  84. fn_update_functions;;
  85. monitor)
  86. fn_monitor;;
  87. email-test)
  88. fn_email_test;;
  89. details)
  90. fn_details;;
  91. backup)
  92. fn_backup;;
  93. console)
  94. fn_console;;
  95. debug)
  96. fn_debug;;
  97. install)
  98. fn_install;;
  99. map-compressor)
  100. fn_compress_ut99maps;;
  101. *)
  102. echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  103. exit 1;;
  104. esac
  105. exit
  106. }
  107. fn_getopt_unreal2(){
  108. case "$getopt" in
  109. start)
  110. fn_start;;
  111. stop)
  112. fn_stop;;
  113. restart)
  114. fn_restart;;
  115. update)
  116. fn_update_check;;
  117. force-update)
  118. forceupdate=1;
  119. fn_update_check;;
  120. update-restart)
  121. forceupdate=1;
  122. fn_update_check;;
  123. update-functions)
  124. fn_update_functions;;
  125. validate)
  126. fn_validate;;
  127. monitor)
  128. fn_monitor;;
  129. email-test)
  130. fn_email_test;;
  131. details)
  132. fn_details;;
  133. backup)
  134. fn_backup;;
  135. console)
  136. fn_console;;
  137. debug)
  138. fn_debug;;
  139. install)
  140. fn_install;;
  141. auto-install)
  142. fn_autoinstall;;
  143. map-compressor)
  144. fn_compress_unreal2maps;;
  145. *)
  146. echo "Usage: $0 {start|stop|restart|update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  147. exit 1;;
  148. esac
  149. exit
  150. }
  151. fn_getopt_ut2k4(){
  152. case "$getopt" in
  153. start)
  154. fn_start;;
  155. stop)
  156. fn_stop;;
  157. restart)
  158. fn_restart;;
  159. update-functions)
  160. fn_update_functions;;
  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. map-compressor)
  176. fn_compress_unreal2maps;;
  177. *)
  178. echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  179. exit 1;;
  180. esac
  181. exit
  182. }
  183. if [ "${gamename}" == "Teamspeak 3" ]; then
  184. fn_getopt_teamspeak3
  185. elif [ "${engine}" == "unreal2" ]; then
  186. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  187. fn_getopt_ut2k4
  188. else
  189. fn_getopt_unreal2
  190. fi
  191. elif [ "${engine}" == "unreal" ]; then
  192. fn_getopt_unreal
  193. else
  194. fn_getopt_generic
  195. fi