4
0

core_getopt.sh 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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_update_no_steam(){
  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. u|update)
  89. command_update.sh;;
  90. uf|update-functions)
  91. command_update_functions.sh;;
  92. m|monitor)
  93. command_monitor.sh;;
  94. ta|test-alert)
  95. command_test_alert.sh;;
  96. dt|details)
  97. command_details.sh;;
  98. pd|postdetails)
  99. command_postdetails.sh;;
  100. b|backup)
  101. command_backup.sh;;
  102. c|console)
  103. command_console.sh;;
  104. d|debug)
  105. command_debug.sh;;
  106. dev|dev-debug)
  107. command_dev_debug.sh;;
  108. i|install)
  109. command_install.sh;;
  110. ai|auto-install)
  111. fn_autoinstall;;
  112. dd|detect-deps)
  113. command_dev_detect_deps.sh;;
  114. dg|detect-glibc)
  115. command_dev_detect_glibc.sh;;
  116. dl|detect-ldd)
  117. command_dev_detect_ldd.sh;;
  118. *)
  119. if [ -n "${getopt}" ]; then
  120. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  121. exitcode=2
  122. fi
  123. echo "Usage: $0 [option]"
  124. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  125. echo "https://gameservermanagers.com/${selfname}"
  126. echo -e ""
  127. echo -e "${lightyellow}Commands${default}"
  128. {
  129. echo -e "${blue}start\t${default}st |Start the server."
  130. echo -e "${blue}stop\t${default}sp |Stop the server."
  131. echo -e "${blue}restart\t${default}r |Restart the server."
  132. echo -e "${blue}update\t${default}u |Checks and applies updates."
  133. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  134. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  135. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  136. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  137. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  138. echo -e "${blue}backup\t${default}b |Create archive of the server."
  139. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  140. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  141. echo -e "${blue}install\t${default}i |Install the server."
  142. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  143. } | column -s $'\t' -t
  144. esac
  145. }
  146. fn_getopt_generic_no_update(){
  147. case "${getopt}" in
  148. st|start)
  149. command_start.sh;;
  150. sp|stop)
  151. command_stop.sh;;
  152. r|restart)
  153. command_restart.sh;;
  154. uf|update-functions)
  155. command_update_functions.sh;;
  156. m|monitor)
  157. command_monitor.sh;;
  158. ta|test-alert)
  159. command_test_alert.sh;;
  160. dt|details)
  161. command_details.sh;;
  162. pd|postdetails)
  163. command_postdetails.sh;;
  164. b|backup)
  165. command_backup.sh;;
  166. c|console)
  167. command_console.sh;;
  168. d|debug)
  169. command_debug.sh;;
  170. dev|dev-debug)
  171. command_dev_debug.sh;;
  172. i|install)
  173. command_install.sh;;
  174. ai|auto-install)
  175. fn_autoinstall;;
  176. dd|detect-deps)
  177. command_dev_detect_deps.sh;;
  178. dg|detect-glibc)
  179. command_dev_detect_glibc.sh;;
  180. dl|detect-ldd)
  181. command_dev_detect_ldd.sh;;
  182. *)
  183. if [ -n "${getopt}" ]; then
  184. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  185. exitcode=2
  186. fi
  187. echo "Usage: $0 [option]"
  188. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  189. echo "https://gameservermanagers.com/${selfname}"
  190. echo -e ""
  191. echo -e "${lightyellow}Commands${default}"
  192. {
  193. echo -e "${blue}start\t${default}st |Start the server."
  194. echo -e "${blue}stop\t${default}sp |Stop the server."
  195. echo -e "${blue}restart\t${default}r |Restart the server."
  196. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  197. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  198. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  199. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  200. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  201. echo -e "${blue}backup\t${default}b |Create archive of the server."
  202. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  203. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  204. echo -e "${blue}install\t${default}i |Install the server."
  205. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  206. } | column -s $'\t' -t
  207. esac
  208. }
  209. fn_getopt_teamspeak3(){
  210. case "${getopt}" in
  211. st|start)
  212. command_start.sh;;
  213. sp|stop)
  214. command_stop.sh;;
  215. r|restart)
  216. command_restart.sh;;
  217. u|update)
  218. command_update.sh;;
  219. uf|update-functions)
  220. command_update_functions.sh;;
  221. m|monitor)
  222. command_monitor.sh;;
  223. ta|test-alert)
  224. command_test_alert.sh;;
  225. dt|details)
  226. command_details.sh;;
  227. pd|postdetails)
  228. command_postdetails.sh;;
  229. b|backup)
  230. command_backup.sh;;
  231. pw|change-password)
  232. command_ts3_server_pass.sh;;
  233. dev|dev-debug)
  234. command_dev_debug.sh;;
  235. i|install)
  236. command_install.sh;;
  237. ai|auto-install)
  238. fn_autoinstall;;
  239. dd|detect-deps)
  240. command_dev_detect_deps.sh;;
  241. dg|detect-glibc)
  242. command_dev_detect_glibc.sh;;
  243. dl|detect-ldd)
  244. command_dev_detect_ldd.sh;;
  245. *)
  246. if [ -n "${getopt}" ]; then
  247. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  248. exitcode=2
  249. fi
  250. echo "Usage: $0 [option]"
  251. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  252. echo "https://gameservermanagers.com/${selfname}"
  253. echo -e ""
  254. echo -e "${lightyellow}Commands${default}"
  255. {
  256. echo -e "${blue}start\t${default}st |Start the server."
  257. echo -e "${blue}stop\t${default}sp |Stop the server."
  258. echo -e "${blue}restart\t${default}r |Restart the server."
  259. echo -e "${blue}update\t${default}u |Checks and applies updates from teamspeak.com."
  260. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  261. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  262. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  263. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  264. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  265. echo -e "${blue}change-password\t${default}pw |Changes TS3 serveradmin password."
  266. echo -e "${blue}backup\t${default}b |Create archive of the server."
  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_minecraft(){
  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. c|console)
  295. command_console.sh;;
  296. d|debug)
  297. command_debug.sh;;
  298. dev|dev-debug)
  299. command_dev_debug.sh;;
  300. i|install)
  301. command_install.sh;;
  302. ai|auto-install)
  303. fn_autoinstall;;
  304. dd|detect-deps)
  305. command_dev_detect_deps.sh;;
  306. dg|detect-glibc)
  307. command_dev_detect_glibc.sh;;
  308. dl|detect-ldd)
  309. command_dev_detect_ldd.sh;;
  310. *)
  311. if [ -n "${getopt}" ]; then
  312. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  313. exitcode=2
  314. fi
  315. echo "Usage: $0 [option]"
  316. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  317. echo "https://gameservermanagers.com/${selfname}"
  318. echo -e ""
  319. echo -e "${lightyellow}Commands${default}"
  320. {
  321. echo -e "${blue}start\t${default}st |Start the server."
  322. echo -e "${blue}stop\t${default}sp |Stop the server."
  323. echo -e "${blue}restart\t${default}r |Restart the server."
  324. echo -e "${blue}update\t${default}u |Checks and applies updates from mojang.com."
  325. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  326. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  327. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  328. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  329. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  330. echo -e "${blue}backup\t${default}b |Create archive of the server."
  331. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  332. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  333. echo -e "${blue}install\t${default}i |Install the server."
  334. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  335. } | column -s $'\t' -t
  336. esac
  337. }
  338. fn_getopt_mumble(){
  339. case "${getopt}" in
  340. st|start)
  341. command_start.sh;;
  342. sp|stop)
  343. command_stop.sh;;
  344. r|restart)
  345. command_restart.sh;;
  346. u|update)
  347. command_update.sh;;
  348. uf|update-functions)
  349. command_update_functions.sh;;
  350. m|monitor)
  351. command_monitor.sh;;
  352. ta|test-alert)
  353. command_test_alert.sh;;
  354. dt|details)
  355. command_details.sh;;
  356. pd|postdetails)
  357. command_postdetails.sh;;
  358. b|backup)
  359. command_backup.sh;;
  360. dev|dev-debug)
  361. command_dev_debug.sh;;
  362. c|console)
  363. command_console.sh;;
  364. i|install)
  365. command_install.sh;;
  366. dd|detect-deps)
  367. command_dev_detect_deps.sh;;
  368. dg|detect-glibc)
  369. command_dev_detect_glibc.sh;;
  370. dl|detect-ldd)
  371. command_dev_detect_ldd.sh;;
  372. *)
  373. if [ -n "${getopt}" ]; then
  374. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  375. exitcode=2
  376. fi
  377. echo "Usage: $0 [option]"
  378. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  379. echo "https://gameservermanagers.com/${selfname}"
  380. echo -e ""
  381. echo -e "${lightyellow}Commands${default}"
  382. {
  383. echo -e "${blue}start\t${default}st |Start the server."
  384. echo -e "${blue}stop\t${default}sp |Stop the server."
  385. echo -e "${blue}restart\t${default}r |Restart the server."
  386. echo -e "${blue}update\t${default}u |Checks and applies updates from GitHub."
  387. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  388. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  389. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  390. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  391. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  392. echo -e "${blue}backup\t${default}b |Create archive of the server."
  393. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  394. echo -e "${blue}install\t${default}i |Install the server."
  395. } | column -s $'\t' -t
  396. esac
  397. }
  398. fn_getopt_dstserver(){
  399. case "${getopt}" in
  400. st|start)
  401. command_start.sh;;
  402. sp|stop)
  403. command_stop.sh;;
  404. r|restart)
  405. command_restart.sh;;
  406. u|update)
  407. command_update.sh;;
  408. fu|force-update|update-restart)
  409. forceupdate=1;
  410. command_update.sh;;
  411. uf|update-functions)
  412. command_update_functions.sh;;
  413. v|validate)
  414. command_validate.sh;;
  415. m|monitor)
  416. command_monitor.sh;;
  417. ta|test-alert)
  418. command_test_alert.sh;;
  419. dt|details)
  420. command_details.sh;;
  421. pd|postdetails)
  422. command_postdetails.sh;;
  423. b|backup)
  424. command_backup.sh;;
  425. c|console)
  426. command_console.sh;;
  427. d|debug)
  428. command_debug.sh;;
  429. dev|dev-debug)
  430. command_dev_debug.sh;;
  431. i|install)
  432. command_install.sh;;
  433. ai|auto-install)
  434. fn_autoinstall;;
  435. ct|cluster-token)
  436. install_dst_token.sh;;
  437. dd|detect-deps)
  438. command_dev_detect_deps.sh;;
  439. dg|detect-glibc)
  440. command_dev_detect_glibc.sh;;
  441. dl|detect-ldd)
  442. command_dev_detect_ldd.sh;;
  443. *)
  444. if [ -n "${getopt}" ]; then
  445. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  446. exitcode=2
  447. fi
  448. echo "Usage: $0 [option]"
  449. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  450. echo "https://gameservermanagers.com/${selfname}"
  451. echo -e ""
  452. echo -e "${lightyellow}Commands${default}"
  453. {
  454. echo -e "${blue}start\t${default}st |Start the server."
  455. echo -e "${blue}stop\t${default}sp |Stop the server."
  456. echo -e "${blue}restart\t${default}r |Restart the server."
  457. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  458. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  459. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  460. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  461. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  462. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  463. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  464. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  465. echo -e "${blue}backup\t${default}b |Create archive of the server."
  466. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  467. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  468. echo -e "${blue}install\t${default}i |Install the server."
  469. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  470. echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
  471. } | column -s $'\t' -t
  472. esac
  473. }
  474. fn_getopt_gmodserver(){
  475. case "${getopt}" in
  476. st|start)
  477. command_start.sh;;
  478. sp|stop)
  479. command_stop.sh;;
  480. r|restart)
  481. command_restart.sh;;
  482. u|update)
  483. command_update.sh;;
  484. fu|force-update|update-restart)
  485. forceupdate=1;
  486. command_update.sh;;
  487. uf|update-functions)
  488. command_update_functions.sh;;
  489. v|validate)
  490. command_validate.sh;;
  491. m|monitor)
  492. command_monitor.sh;;
  493. ta|test-alert)
  494. command_test_alert.sh;;
  495. dt|details)
  496. command_details.sh;;
  497. pd|postdetails)
  498. command_postdetails.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. dd|detect-deps)
  512. command_dev_detect_deps.sh;;
  513. dg|detect-glibc)
  514. command_dev_detect_glibc.sh;;
  515. dl|detect-ldd)
  516. command_dev_detect_ldd.sh;;
  517. fd|fastdl)
  518. command_fastdl.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\t${default}u |Checks and applies updates from SteamCMD."
  534. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  535. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  536. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  537. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  538. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  539. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  540. echo -e "${blue}backup\t${default}b |Create archive of the server."
  541. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  542. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  543. echo -e "${blue}install\t${default}i |Install the server."
  544. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  545. echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
  546. } | column -s $'\t' -t
  547. esac
  548. }
  549. fn_getopt_unreal(){
  550. case "${getopt}" in
  551. st|start)
  552. command_start.sh;;
  553. sp|stop)
  554. command_stop.sh;;
  555. r|restart)
  556. command_restart.sh;;
  557. uf|update-functions)
  558. command_update_functions.sh;;
  559. m|monitor)
  560. command_monitor.sh;;
  561. ta|test-alert)
  562. command_test_alert.sh;;
  563. dt|details)
  564. command_details.sh;;
  565. b|backup)
  566. command_backup.sh;;
  567. c|console)
  568. command_console.sh;;
  569. d|debug)
  570. command_debug.sh;;
  571. dev|dev-debug)
  572. command_dev_debug.sh;;
  573. i|install)
  574. command_install.sh;;
  575. ai|auto-install)
  576. fn_autoinstall;;
  577. mc|map-compressor)
  578. compress_ut99_maps.sh;;
  579. dd|detect-deps)
  580. command_dev_detect_deps.sh;;
  581. dg|detect-glibc)
  582. command_dev_detect_glibc.sh;;
  583. dl|detect-ldd)
  584. command_dev_detect_ldd.sh;;
  585. *)
  586. if [ -n "${getopt}" ]; then
  587. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  588. exitcode=2
  589. fi
  590. echo "Usage: $0 [option]"
  591. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  592. echo "https://gameservermanagers.com/${selfname}"
  593. echo -e ""
  594. echo -e "${lightyellow}Commands${default}"
  595. {
  596. echo -e "${blue}start\t${default}st |Start the server."
  597. echo -e "${blue}stop\t${default}sp |Stop the server."
  598. echo -e "${blue}restart\t${default}r |Restart the server."
  599. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  600. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  601. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  602. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  603. echo -e "${blue}backup\t${default}b |Create archive of the server."
  604. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  605. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  606. echo -e "${blue}install\t${default}i |Install the server."
  607. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  608. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  609. } | column -s $'\t' -t
  610. esac
  611. }
  612. fn_getopt_unreal2(){
  613. case "${getopt}" in
  614. st|start)
  615. command_start.sh;;
  616. sp|stop)
  617. command_stop.sh;;
  618. r|restart)
  619. command_restart.sh;;
  620. u|update)
  621. command_update.sh;;
  622. fu|force-update|update-restart)
  623. forceupdate=1;
  624. command_update.sh;;
  625. uf|update-functions)
  626. command_update_functions.sh;;
  627. v|validate)
  628. command_validate.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. dd|detect-deps)
  648. command_dev_detect_deps.sh;;
  649. dg|detect-glibc)
  650. command_dev_detect_glibc.sh;;
  651. dl|detect-ldd)
  652. command_dev_detect_ldd.sh;;
  653. mc|map-compressor)
  654. compress_unreal2_maps.sh;;
  655. *)
  656. if [ -n "${getopt}" ]; then
  657. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  658. exitcode=2
  659. fi
  660. echo "Usage: $0 [option]"
  661. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  662. echo "https://gameservermanagers.com/${selfname}"
  663. echo -e ""
  664. echo -e "${lightyellow}Commands${default}"
  665. {
  666. echo -e "${blue}start\t${default}st |Start the server."
  667. echo -e "${blue}stop\t${default}sp |Stop the server."
  668. echo -e "${blue}restart\t${default}r |Restart the server."
  669. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  670. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  671. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  672. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  673. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  674. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  675. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  676. echo -e "${blue}backup\t${default}b |Create archive of the server."
  677. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  678. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  679. echo -e "${blue}install\t${default}i |Install the server."
  680. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  681. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  682. } | column -s $'\t' -t
  683. esac
  684. }
  685. fn_getopt_ut2k4(){
  686. case "${getopt}" in
  687. st|start)
  688. command_start.sh;;
  689. sp|stop)
  690. command_stop.sh;;
  691. r|restart)
  692. command_restart.sh;;
  693. uf|update-functions)
  694. command_update_functions.sh;;
  695. m|monitor)
  696. command_monitor.sh;;
  697. ta|test-alert)
  698. command_test_alert.sh;;
  699. dt|details)
  700. command_details.sh;;
  701. b|backup)
  702. command_backup.sh;;
  703. c|console)
  704. command_console.sh;;
  705. d|debug)
  706. command_debug.sh;;
  707. dev|dev-debug)
  708. command_dev_debug.sh;;
  709. i|install)
  710. command_install.sh;;
  711. ai|auto-install)
  712. fn_autoinstall;;
  713. cd|server-cd-key)
  714. install_ut2k4_key.sh;;
  715. mc|map-compressor)
  716. compress_unreal2_maps.sh;;
  717. dd|detect-deps)
  718. command_dev_detect_deps.sh;;
  719. dg|detect-glibc)
  720. command_dev_detect_glibc.sh;;
  721. dl|detect-ldd)
  722. command_dev_detect_ldd.sh;;
  723. *)
  724. if [ -n "${getopt}" ]; then
  725. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  726. exitcode=2
  727. fi
  728. echo "Usage: $0 [option]"
  729. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  730. echo "https://gameservermanagers.com/${selfname}"
  731. echo -e ""
  732. echo -e "${lightyellow}Commands${default}"
  733. {
  734. echo -e "${blue}start\t${default}st |Start the server."
  735. echo -e "${blue}stop\t${default}sp |Stop the server."
  736. echo -e "${blue}restart\t${default}r |Restart the server."
  737. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  738. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  739. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  740. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  741. echo -e "${blue}backup\t${default}b |Create archive of the server."
  742. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  743. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  744. echo -e "${blue}install\t${default}i |Install the server."
  745. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  746. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  747. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  748. } | column -s $'\t' -t
  749. esac
  750. }
  751. # Don't Starve Together
  752. if [ "${gamename}" == "Don't Starve Together" ]; then
  753. fn_getopt_dstserver
  754. # Garry's Mod
  755. elif [ "${gamename}" == "Garry's Mod" ]; then
  756. fn_getopt_gmodserver
  757. # Minecraft
  758. elif [ "${engine}" == "lwjgl2" ]; then
  759. fn_getopt_minecraft
  760. # Mumble
  761. elif [ "${gamename}" == "Mumble" ]; then
  762. fn_getopt_mumble
  763. # Teamspeak 3
  764. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  765. fn_getopt_teamspeak3
  766. # Unreal 2 Engine
  767. elif [ "${engine}" == "unreal2" ]; then
  768. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  769. fn_getopt_ut2k4
  770. else
  771. fn_getopt_unreal2
  772. fi
  773. # Unreal Engine
  774. elif [ "${engine}" == "unreal" ]; then
  775. fn_getopt_unreal
  776. # Generic
  777. elif [ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${gamename}" == "Call of Duty 2" ]||[ "${gamename}" == "Call of Duty 4" ]||[ "${gamename}" == "Call of Duty: World at War" ]||[ "${gamename}" == "QuakeWorld" ]||[ "${gamename}" == "Quake 2" ]||[ "${gamename}" == "Quake 3: Arena" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  778. fn_getopt_generic_no_update
  779. elif [ "${gamename}" == "Factorio" ]; then
  780. fn_getopt_generic_update_no_steam
  781. else
  782. fn_getopt_generic
  783. fi
  784. core_exit.sh