fn_getopt 2.6 KB

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