fn_getopt 2.7 KB

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