core_getopt.sh 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. #!/bin/bash
  2. # LGSM core_getopt.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: getopt arguments.
  6. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  7. fn_getopt_generic(){
  8. case "${getopt}" in
  9. st|start)
  10. command_start.sh;;
  11. sp|stop)
  12. command_stop.sh;;
  13. r|restart)
  14. command_restart.sh;;
  15. u|update)
  16. command_update.sh;;
  17. fu|force-update|update-restart)
  18. forceupdate=1;
  19. command_update.sh;;
  20. uf|update-functions)
  21. command_update_functions.sh;;
  22. v|validate)
  23. command_validate.sh;;
  24. m|monitor)
  25. command_monitor.sh;;
  26. ta|test-alert)
  27. command_test_alert.sh;;
  28. dt|details)
  29. command_details.sh;;
  30. pd|postdetails)
  31. command_postdetails.sh;;
  32. b|backup)
  33. command_backup.sh;;
  34. c|console)
  35. command_console.sh;;
  36. d|debug)
  37. command_debug.sh;;
  38. dev|dev-debug)
  39. command_dev_debug.sh;;
  40. i|install)
  41. command_install.sh;;
  42. ai|auto-install)
  43. fn_autoinstall;;
  44. dd|detect-deps)
  45. command_dev_detect_deps.sh;;
  46. dg|detect-glibc)
  47. command_dev_detect_glibc.sh;;
  48. dl|detect-ldd)
  49. command_dev_detect_ldd.sh;;
  50. *)
  51. if [ -n "${getopt}" ]; then
  52. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  53. exitcode=2
  54. fi
  55. echo "Usage: $0 [option]"
  56. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  57. echo "https://gameservermanagers.com/${selfname}"
  58. echo -e ""
  59. echo -e "${lightyellow}Commands${default}"
  60. {
  61. echo -e "${blue}start\t${default}st |Start the server."
  62. echo -e "${blue}stop\t${default}sp |Stop the server."
  63. echo -e "${blue}restart\t${default}r |Restart the server."
  64. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  65. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  66. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  67. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  68. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  69. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  70. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  71. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  72. echo -e "${blue}backup\t${default}b |Create archive of the server."
  73. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  74. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  75. echo -e "${blue}install\t${default}i |Install the server."
  76. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  77. } | column -s $'\t' -t
  78. esac
  79. }
  80. fn_getopt_generic_no_update(){
  81. case "${getopt}" in
  82. st|start)
  83. command_start.sh;;
  84. sp|stop)
  85. command_stop.sh;;
  86. r|restart)
  87. command_restart.sh;;
  88. uf|update-functions)
  89. command_update_functions.sh;;
  90. m|monitor)
  91. command_monitor.sh;;
  92. ta|test-alert)
  93. command_test_alert.sh;;
  94. dt|details)
  95. command_details.sh;;
  96. pd|postdetails)
  97. command_postdetails.sh;;
  98. b|backup)
  99. command_backup.sh;;
  100. c|console)
  101. command_console.sh;;
  102. d|debug)
  103. command_debug.sh;;
  104. dev|dev-debug)
  105. command_dev_debug.sh;;
  106. i|install)
  107. command_install.sh;;
  108. ai|auto-install)
  109. fn_autoinstall;;
  110. dd|detect-deps)
  111. command_dev_detect_deps.sh;;
  112. dg|detect-glibc)
  113. command_dev_detect_glibc.sh;;
  114. dl|detect-ldd)
  115. command_dev_detect_ldd.sh;;
  116. *)
  117. if [ -n "${getopt}" ]; then
  118. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  119. exitcode=2
  120. fi
  121. echo "Usage: $0 [option]"
  122. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  123. echo "https://gameservermanagers.com/${selfname}"
  124. echo -e ""
  125. echo -e "${lightyellow}Commands${default}"
  126. {
  127. echo -e "${blue}start\t${default}st |Start the server."
  128. echo -e "${blue}stop\t${default}sp |Stop the server."
  129. echo -e "${blue}restart\t${default}r |Restart the server."
  130. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  131. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  132. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  133. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  134. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  135. echo -e "${blue}backup\t${default}b |Create archive of the server."
  136. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  137. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  138. echo -e "${blue}install\t${default}i |Install the server."
  139. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  140. } | column -s $'\t' -t
  141. esac
  142. }
  143. fn_getopt_teamspeak3(){
  144. case "${getopt}" in
  145. st|start)
  146. command_start.sh;;
  147. sp|stop)
  148. command_stop.sh;;
  149. r|restart)
  150. command_restart.sh;;
  151. u|update)
  152. command_update.sh;;
  153. uf|update-functions)
  154. command_update_functions.sh;;
  155. m|monitor)
  156. command_monitor.sh;;
  157. ta|test-alert)
  158. command_test_alert.sh;;
  159. dt|details)
  160. command_details.sh;;
  161. pd|postdetails)
  162. command_postdetails.sh;;
  163. b|backup)
  164. command_backup.sh;;
  165. pw|change-password)
  166. command_ts3_server_pass.sh;;
  167. dev|dev-debug)
  168. command_dev_debug.sh;;
  169. i|install)
  170. command_install.sh;;
  171. ai|auto-install)
  172. fn_autoinstall;;
  173. dd|detect-deps)
  174. command_dev_detect_deps.sh;;
  175. dg|detect-glibc)
  176. command_dev_detect_glibc.sh;;
  177. dl|detect-ldd)
  178. command_dev_detect_ldd.sh;;
  179. *)
  180. if [ -n "${getopt}" ]; then
  181. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  182. exitcode=2
  183. fi
  184. echo "Usage: $0 [option]"
  185. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  186. echo "https://gameservermanagers.com/${selfname}"
  187. echo -e ""
  188. echo -e "${lightyellow}Commands${default}"
  189. {
  190. echo -e "${blue}start\t${default}st |Start the server."
  191. echo -e "${blue}stop\t${default}sp |Stop the server."
  192. echo -e "${blue}restart\t${default}r |Restart the server."
  193. echo -e "${blue}update\t${default}u |Checks and applies updates from teamspeak.com."
  194. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  195. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  196. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  197. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  198. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  199. echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
  200. echo -e "${blue}backup\t${default}b |Create archive of the server."
  201. echo -e "${blue}install\t${default}i |Install the server."
  202. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  203. } | column -s $'\t' -t
  204. esac
  205. }
  206. fn_getopt_minecraft(){
  207. case "${getopt}" in
  208. st|start)
  209. command_start.sh;;
  210. sp|stop)
  211. command_stop.sh;;
  212. r|restart)
  213. command_restart.sh;;
  214. u|update)
  215. command_update.sh;;
  216. uf|update-functions)
  217. command_update_functions.sh;;
  218. m|monitor)
  219. command_monitor.sh;;
  220. ta|test-alert)
  221. command_test_alert.sh;;
  222. dt|details)
  223. command_details.sh;;
  224. pd|postdetails)
  225. command_postdetails.sh;;
  226. b|backup)
  227. command_backup.sh;;
  228. c|console)
  229. command_console.sh;;
  230. d|debug)
  231. command_debug.sh;;
  232. dev|dev-debug)
  233. command_dev_debug.sh;;
  234. i|install)
  235. command_install.sh;;
  236. ai|auto-install)
  237. fn_autoinstall;;
  238. dd|detect-deps)
  239. command_dev_detect_deps.sh;;
  240. dg|detect-glibc)
  241. command_dev_detect_glibc.sh;;
  242. dl|detect-ldd)
  243. command_dev_detect_ldd.sh;;
  244. *)
  245. if [ -n "${getopt}" ]; then
  246. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  247. exitcode=2
  248. fi
  249. echo "Usage: $0 [option]"
  250. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  251. echo "https://gameservermanagers.com/${selfname}"
  252. echo -e ""
  253. echo -e "${lightyellow}Commands${default}"
  254. {
  255. echo -e "${blue}start\t${default}st |Start the server."
  256. echo -e "${blue}stop\t${default}sp |Stop the server."
  257. echo -e "${blue}restart\t${default}r |Restart the server."
  258. echo -e "${blue}update\t${default}u |Checks and applies updates from mojang.com."
  259. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  260. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  261. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  262. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  263. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  264. echo -e "${blue}backup\t${default}b |Create archive of the server."
  265. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  266. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  267. echo -e "${blue}install\t${default}i |Install the server."
  268. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  269. } | column -s $'\t' -t
  270. esac
  271. }
  272. fn_getopt_mumble(){
  273. case "${getopt}" in
  274. st|start)
  275. command_start.sh;;
  276. sp|stop)
  277. command_stop.sh;;
  278. r|restart)
  279. command_restart.sh;;
  280. u|update)
  281. command_update.sh;;
  282. uf|update-functions)
  283. command_update_functions.sh;;
  284. m|monitor)
  285. command_monitor.sh;;
  286. ta|test-alert)
  287. command_test_alert.sh;;
  288. dt|details)
  289. command_details.sh;;
  290. pd|postdetails)
  291. command_postdetails.sh;;
  292. b|backup)
  293. command_backup.sh;;
  294. dev|dev-debug)
  295. command_dev_debug.sh;;
  296. c|console)
  297. command_console.sh;;
  298. i|install)
  299. command_install.sh;;
  300. dd|detect-deps)
  301. command_dev_detect_deps.sh;;
  302. dg|detect-glibc)
  303. command_dev_detect_glibc.sh;;
  304. dl|detect-ldd)
  305. command_dev_detect_ldd.sh;;
  306. *)
  307. if [ -n "${getopt}" ]; then
  308. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  309. exitcode=2
  310. fi
  311. echo "Usage: $0 [option]"
  312. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  313. echo "https://gameservermanagers.com/${selfname}"
  314. echo -e ""
  315. echo -e "${lightyellow}Commands${default}"
  316. {
  317. echo -e "${blue}start\t${default}st |Start the server."
  318. echo -e "${blue}stop\t${default}sp |Stop the server."
  319. echo -e "${blue}restart\t${default}r |Restart the server."
  320. echo -e "${blue}update\t${default}u |Checks and applies updates from GitHub."
  321. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  322. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  323. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  324. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  325. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  326. echo -e "${blue}backup\t${default}b |Create archive of the server."
  327. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  328. echo -e "${blue}install\t${default}i |Install the server."
  329. } | column -s $'\t' -t
  330. esac
  331. }
  332. fn_getopt_dstserver(){
  333. case "${getopt}" in
  334. st|start)
  335. command_start.sh;;
  336. sp|stop)
  337. command_stop.sh;;
  338. r|restart)
  339. command_restart.sh;;
  340. u|update)
  341. command_update.sh;;
  342. fu|force-update|update-restart)
  343. forceupdate=1;
  344. command_update.sh;;
  345. uf|update-functions)
  346. command_update_functions.sh;;
  347. v|validate)
  348. command_validate.sh;;
  349. m|monitor)
  350. command_monitor.sh;;
  351. ta|test-alert)
  352. command_test_alert.sh;;
  353. dt|details)
  354. command_details.sh;;
  355. pd|postdetails)
  356. command_postdetails.sh;;
  357. b|backup)
  358. command_backup.sh;;
  359. c|console)
  360. command_console.sh;;
  361. d|debug)
  362. command_debug.sh;;
  363. dev|dev-debug)
  364. command_dev_debug.sh;;
  365. i|install)
  366. command_install.sh;;
  367. ai|auto-install)
  368. fn_autoinstall;;
  369. ct|cluster-token)
  370. install_dst_token.sh;;
  371. dd|detect-deps)
  372. command_dev_detect_deps.sh;;
  373. dg|detect-glibc)
  374. command_dev_detect_glibc.sh;;
  375. dl|detect-ldd)
  376. command_dev_detect_ldd.sh;;
  377. *)
  378. if [ -n "${getopt}" ]; then
  379. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  380. exitcode=2
  381. fi
  382. echo "Usage: $0 [option]"
  383. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  384. echo "https://gameservermanagers.com/${selfname}"
  385. echo -e ""
  386. echo -e "${lightyellow}Commands${default}"
  387. {
  388. echo -e "${blue}start\t${default}st |Start the server."
  389. echo -e "${blue}stop\t${default}sp |Stop the server."
  390. echo -e "${blue}restart\t${default}r |Restart the server."
  391. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  392. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  393. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  394. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  395. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  396. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  397. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  398. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  399. echo -e "${blue}backup\t${default}b |Create archive of the server."
  400. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  401. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  402. echo -e "${blue}install\t${default}i |Install the server."
  403. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  404. echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
  405. } | column -s $'\t' -t
  406. esac
  407. }
  408. fn_getopt_gmodserver(){
  409. case "${getopt}" in
  410. st|start)
  411. command_start.sh;;
  412. sp|stop)
  413. command_stop.sh;;
  414. r|restart)
  415. command_restart.sh;;
  416. u|update)
  417. command_update.sh;;
  418. fu|force-update|update-restart)
  419. forceupdate=1;
  420. command_update.sh;;
  421. uf|update-functions)
  422. command_update_functions.sh;;
  423. v|validate)
  424. command_validate.sh;;
  425. m|monitor)
  426. command_monitor.sh;;
  427. ta|test-alert)
  428. command_test_alert.sh;;
  429. dt|details)
  430. command_details.sh;;
  431. pd|postdetails)
  432. command_postdetails.sh;;
  433. b|backup)
  434. command_backup.sh;;
  435. c|console)
  436. command_console.sh;;
  437. d|debug)
  438. command_debug.sh;;
  439. dev|dev-debug)
  440. command_dev_debug.sh;;
  441. i|install)
  442. command_install.sh;;
  443. ai|auto-install)
  444. fn_autoinstall;;
  445. dd|detect-deps)
  446. command_dev_detect_deps.sh;;
  447. dg|detect-glibc)
  448. command_dev_detect_glibc.sh;;
  449. dl|detect-ldd)
  450. command_dev_detect_ldd.sh;;
  451. fd|fastdl)
  452. command_fastdl.sh;;
  453. *)
  454. if [ -n "${getopt}" ]; then
  455. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  456. exitcode=2
  457. fi
  458. echo "Usage: $0 [option]"
  459. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  460. echo "https://gameservermanagers.com/${selfname}"
  461. echo -e ""
  462. echo -e "${lightyellow}Commands${default}"
  463. {
  464. echo -e "${blue}start\t${default}st |Start the server."
  465. echo -e "${blue}stop\t${default}sp |Stop the server."
  466. echo -e "${blue}restart\t${default}r |Restart the server."
  467. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  468. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  469. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  470. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  471. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  472. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  473. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  474. echo -e "${blue}backup\t${default}b |Create archive of the server."
  475. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  476. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  477. echo -e "${blue}install\t${default}i |Install the server."
  478. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  479. echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
  480. } | column -s $'\t' -t
  481. esac
  482. }
  483. fn_getopt_unreal(){
  484. case "${getopt}" in
  485. st|start)
  486. command_start.sh;;
  487. sp|stop)
  488. command_stop.sh;;
  489. r|restart)
  490. command_restart.sh;;
  491. uf|update-functions)
  492. command_update_functions.sh;;
  493. m|monitor)
  494. command_monitor.sh;;
  495. ta|test-alert)
  496. command_test_alert.sh;;
  497. dt|details)
  498. command_details.sh;;
  499. b|backup)
  500. command_backup.sh;;
  501. c|console)
  502. command_console.sh;;
  503. d|debug)
  504. command_debug.sh;;
  505. dev|dev-debug)
  506. command_dev_debug.sh;;
  507. i|install)
  508. command_install.sh;;
  509. ai|auto-install)
  510. fn_autoinstall;;
  511. mc|map-compressor)
  512. compress_ut99_maps.sh;;
  513. dd|detect-deps)
  514. command_dev_detect_deps.sh;;
  515. dg|detect-glibc)
  516. command_dev_detect_glibc.sh;;
  517. dl|detect-ldd)
  518. command_dev_detect_ldd.sh;;
  519. *)
  520. if [ -n "${getopt}" ]; then
  521. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  522. exitcode=2
  523. fi
  524. echo "Usage: $0 [option]"
  525. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  526. echo "https://gameservermanagers.com/${selfname}"
  527. echo -e ""
  528. echo -e "${lightyellow}Commands${default}"
  529. {
  530. echo -e "${blue}start\t${default}st |Start the server."
  531. echo -e "${blue}stop\t${default}sp |Stop the server."
  532. echo -e "${blue}restart\t${default}r |Restart the server."
  533. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  534. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  535. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  536. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  537. echo -e "${blue}backup\t${default}b |Create archive of the server."
  538. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  539. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  540. echo -e "${blue}install\t${default}i |Install the server."
  541. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  542. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  543. } | column -s $'\t' -t
  544. esac
  545. }
  546. fn_getopt_unreal2(){
  547. case "${getopt}" in
  548. st|start)
  549. command_start.sh;;
  550. sp|stop)
  551. command_stop.sh;;
  552. r|restart)
  553. command_restart.sh;;
  554. u|update)
  555. command_update.sh;;
  556. fu|force-update|update-restart)
  557. forceupdate=1;
  558. command_update.sh;;
  559. uf|update-functions)
  560. command_update_functions.sh;;
  561. v|validate)
  562. command_validate.sh;;
  563. m|monitor)
  564. command_monitor.sh;;
  565. ta|test-alert)
  566. command_test_alert.sh;;
  567. dt|details)
  568. command_details.sh;;
  569. b|backup)
  570. command_backup.sh;;
  571. c|console)
  572. command_console.sh;;
  573. d|debug)
  574. command_debug.sh;;
  575. dev|dev-debug)
  576. command_dev_debug.sh;;
  577. i|install)
  578. command_install.sh;;
  579. ai|auto-install)
  580. fn_autoinstall;;
  581. dd|detect-deps)
  582. command_dev_detect_deps.sh;;
  583. dg|detect-glibc)
  584. command_dev_detect_glibc.sh;;
  585. dl|detect-ldd)
  586. command_dev_detect_ldd.sh;;
  587. mc|map-compressor)
  588. compress_unreal2_maps.sh;;
  589. *)
  590. if [ -n "${getopt}" ]; then
  591. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  592. exitcode=2
  593. fi
  594. echo "Usage: $0 [option]"
  595. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  596. echo "https://gameservermanagers.com/${selfname}"
  597. echo -e ""
  598. echo -e "${lightyellow}Commands${default}"
  599. {
  600. echo -e "${blue}start\t${default}st |Start the server."
  601. echo -e "${blue}stop\t${default}sp |Stop the server."
  602. echo -e "${blue}restart\t${default}r |Restart the server."
  603. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  604. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  605. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  606. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  607. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  608. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  609. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  610. echo -e "${blue}backup\t${default}b |Create archive of the server."
  611. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  612. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  613. echo -e "${blue}install\t${default}i |Install the server."
  614. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  615. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  616. } | column -s $'\t' -t
  617. esac
  618. }
  619. fn_getopt_ut2k4(){
  620. case "${getopt}" in
  621. st|start)
  622. command_start.sh;;
  623. sp|stop)
  624. command_stop.sh;;
  625. r|restart)
  626. command_restart.sh;;
  627. uf|update-functions)
  628. command_update_functions.sh;;
  629. m|monitor)
  630. command_monitor.sh;;
  631. ta|test-alert)
  632. command_test_alert.sh;;
  633. dt|details)
  634. command_details.sh;;
  635. b|backup)
  636. command_backup.sh;;
  637. c|console)
  638. command_console.sh;;
  639. d|debug)
  640. command_debug.sh;;
  641. dev|dev-debug)
  642. command_dev_debug.sh;;
  643. i|install)
  644. command_install.sh;;
  645. ai|auto-install)
  646. fn_autoinstall;;
  647. cd|server-cd-key)
  648. install_ut2k4_key.sh;;
  649. mc|map-compressor)
  650. compress_unreal2_maps.sh;;
  651. dd|detect-deps)
  652. command_dev_detect_deps.sh;;
  653. dg|detect-glibc)
  654. command_dev_detect_glibc.sh;;
  655. dl|detect-ldd)
  656. command_dev_detect_ldd.sh;;
  657. *)
  658. if [ -n "${getopt}" ]; then
  659. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  660. exitcode=2
  661. fi
  662. echo "Usage: $0 [option]"
  663. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  664. echo "https://gameservermanagers.com/${selfname}"
  665. echo -e ""
  666. echo -e "${lightyellow}Commands${default}"
  667. {
  668. echo -e "${blue}start\t${default}st |Start the server."
  669. echo -e "${blue}stop\t${default}sp |Stop the server."
  670. echo -e "${blue}restart\t${default}r |Restart the server."
  671. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  672. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  673. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  674. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  675. echo -e "${blue}backup\t${default}b |Create archive of the server."
  676. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  677. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  678. echo -e "${blue}install\t${default}i |Install the server."
  679. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  680. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  681. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  682. } | column -s $'\t' -t
  683. esac
  684. }
  685. if [ "${gamename}" == "Mumble" ]; then
  686. fn_getopt_mumble
  687. elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  688. fn_getopt_generic_no_update
  689. elif [ "${engine}" == "lwjgl2" ]; then
  690. fn_getopt_minecraft
  691. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  692. fn_getopt_teamspeak3
  693. elif [ "${gamename}" == "Don't Starve Together" ]; then
  694. fn_getopt_dstserver
  695. elif [ "${gamename}" == "Garry's Mod" ]; then
  696. fn_getopt_gmodserver
  697. elif [ "${engine}" == "unreal2" ]; then
  698. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  699. fn_getopt_ut2k4
  700. else
  701. fn_getopt_unreal2
  702. fi
  703. elif [ "${engine}" == "unreal" ]; then
  704. fn_getopt_unreal
  705. else
  706. fn_getopt_generic
  707. fi
  708. core_exit.sh