fn_getopt 2.8 KB

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