fn_getopt 2.9 KB

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