fn_getopt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. #!/bin/bash
  2. # LGSM fn_getopt function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 240515
  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. install)
  70. fn_install;;
  71. auto-install)
  72. fn_autoinstall;;
  73. *)
  74. echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup|install|auto-install}"
  75. exit 1;;
  76. esac
  77. exit
  78. }
  79. fn_getopt_unreal(){
  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. details)
  94. fn_details;;
  95. backup)
  96. fn_backup;;
  97. console)
  98. fn_console;;
  99. debug)
  100. fn_debug;;
  101. install)
  102. fn_install;;
  103. map-compressor)
  104. fn_compress_ut99maps;;
  105. *)
  106. echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  107. exit 1;;
  108. esac
  109. exit
  110. }
  111. fn_getopt_unreal2(){
  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. map-compressor)
  148. fn_compress_unreal2maps;;
  149. *)
  150. echo "Usage: $0 {start|stop|restart|update|update-funtions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  151. exit 1;;
  152. esac
  153. exit
  154. }
  155. fn_getopt_ut2k4(){
  156. case "$getopt" in
  157. start)
  158. fn_start;;
  159. stop)
  160. fn_stop;;
  161. restart)
  162. fn_restart;;
  163. update-functions)
  164. fn_update_functions;;
  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. map-compressor)
  180. fn_compress_unreal2maps;;
  181. *)
  182. echo "Usage: $0 {start|stop|restart|update-funtions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  183. exit 1;;
  184. esac
  185. exit
  186. }
  187. if [ "${gamename}" == "Teamspeak 3" ]; then
  188. fn_getopt_teamspeak3
  189. elif [ "${engine}" == "unreal2" ]; then
  190. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  191. fn_getopt_ut2k4
  192. else
  193. fn_getopt_unreal2
  194. fi
  195. elif [ "${engine}" == "unreal" ]; then
  196. fn_getopt_unreal
  197. else
  198. fn_getopt_generic
  199. fi