core_getopt.sh 26 KB

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