fn_getopt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. validate)
  24. fn_validate;;
  25. monitor)
  26. fn_monitor;;
  27. email-test)
  28. fn_email_test;;
  29. details)
  30. fn_details;;
  31. backup)
  32. fn_backup;;
  33. console)
  34. fn_console;;
  35. debug)
  36. fn_debug;;
  37. install)
  38. fn_install;;
  39. auto-install)
  40. fn_autoinstall;;
  41. *)
  42. echo "Usage: $0 {start|stop|restart|update|force-update|validate|monitor|email-test|details|backup|console|debug|install|auto-install}"
  43. exit 1;;
  44. esac
  45. exit
  46. }
  47. fn_getopt_teamspeak3(){
  48. case "$getopt" in
  49. start)
  50. fn_start;;
  51. stop)
  52. fn_stop;;
  53. restart)
  54. fn_restart;;
  55. update)
  56. fn_update_check;;
  57. monitor)
  58. fn_monitor;;
  59. email-test)
  60. fn_email_test;;
  61. details)
  62. fn_details;;
  63. backup)
  64. fn_backup;;
  65. install)
  66. fn_install;;
  67. auto-install)
  68. fn_autoinstall;;
  69. *)
  70. echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup|install|auto-install}"
  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. monitor)
  84. fn_monitor;;
  85. email-test)
  86. fn_email_test;;
  87. details)
  88. fn_details;;
  89. backup)
  90. fn_backup;;
  91. console)
  92. fn_console;;
  93. debug)
  94. fn_debug;;
  95. install)
  96. fn_install;;
  97. map-compressor)
  98. fn_compress_ut99maps;;
  99. *)
  100. echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  101. exit 1;;
  102. esac
  103. exit
  104. }
  105. fn_getopt_unreal2(){
  106. case "$getopt" in
  107. start)
  108. fn_start;;
  109. stop)
  110. fn_stop;;
  111. restart)
  112. fn_restart;;
  113. update)
  114. fn_update_check;;
  115. validate)
  116. fn_validate;;
  117. monitor)
  118. fn_monitor;;
  119. email-test)
  120. fn_email_test;;
  121. details)
  122. fn_details;;
  123. backup)
  124. fn_backup;;
  125. console)
  126. fn_console;;
  127. debug)
  128. fn_debug;;
  129. install)
  130. fn_install;;
  131. auto-install)
  132. fn_autoinstall;;
  133. map-compressor)
  134. fn_compress_unreal2maps;;
  135. *)
  136. echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  137. exit 1;;
  138. esac
  139. exit
  140. }
  141. fn_getopt_ut2k4(){
  142. case "$getopt" in
  143. start)
  144. fn_start;;
  145. stop)
  146. fn_stop;;
  147. restart)
  148. fn_restart;;
  149. monitor)
  150. fn_monitor;;
  151. email-test)
  152. fn_email_test;;
  153. details)
  154. fn_details;;
  155. backup)
  156. fn_backup;;
  157. console)
  158. fn_console;;
  159. debug)
  160. fn_debug;;
  161. install)
  162. fn_install;;
  163. map-compressor)
  164. fn_compress_unreal2maps;;
  165. *)
  166. echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  167. exit 1;;
  168. esac
  169. exit
  170. }
  171. if [ "${gamename}" == "Teamspeak 3" ]; then
  172. fn_getopt_teamspeak3
  173. elif [ "${engine}" == "unreal2" ]; then
  174. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  175. fn_getopt_ut2k4
  176. else
  177. fn_getopt_unreal2
  178. fi
  179. elif [ "${engine}" == "unreal" ]; then
  180. fn_getopt_unreal
  181. else
  182. fn_getopt_generic
  183. fi