fn_getopt 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. backup)
  52. fn_backup;;
  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|backup|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