fn_getopt 2.8 KB

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