4
0

fn_getopt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. *)
  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. force-update)
  112. forceupdate=1;
  113. fn_update_check;;
  114. update-restart)
  115. forceupdate=1;
  116. fn_update_check;;
  117. validate)
  118. fn_validate;;
  119. monitor)
  120. fn_monitor;;
  121. email-test)
  122. fn_email_test;;
  123. details)
  124. fn_details;;
  125. backup)
  126. fn_backup;;
  127. console)
  128. fn_console;;
  129. debug)
  130. fn_debug;;
  131. install)
  132. fn_install;;
  133. auto-install)
  134. fn_autoinstall;;
  135. map-compressor)
  136. fn_compress_unreal2maps;;
  137. *)
  138. echo "Usage: $0 {start|stop|restart|update|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
  139. exit 1;;
  140. esac
  141. exit
  142. }
  143. fn_getopt_ut2k4(){
  144. case "$getopt" in
  145. start)
  146. fn_start;;
  147. stop)
  148. fn_stop;;
  149. restart)
  150. fn_restart;;
  151. monitor)
  152. fn_monitor;;
  153. email-test)
  154. fn_email_test;;
  155. details)
  156. fn_details;;
  157. backup)
  158. fn_backup;;
  159. console)
  160. fn_console;;
  161. debug)
  162. fn_debug;;
  163. install)
  164. fn_install;;
  165. map-compressor)
  166. fn_compress_unreal2maps;;
  167. *)
  168. echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
  169. exit 1;;
  170. esac
  171. exit
  172. }
  173. if [ "${gamename}" == "Teamspeak 3" ]; then
  174. fn_getopt_teamspeak3
  175. elif [ "${engine}" == "unreal2" ]; then
  176. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  177. fn_getopt_ut2k4
  178. else
  179. fn_getopt_unreal2
  180. fi
  181. elif [ "${engine}" == "unreal" ]; then
  182. fn_getopt_unreal
  183. else
  184. fn_getopt_generic
  185. fi