core_getopt.sh 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  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_mta(){
  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. fu|force-update|update-restart)
  358. forceupdate=1;
  359. command_update.sh;;
  360. uf|update-functions)
  361. command_update_functions.sh;;
  362. m|monitor)
  363. command_monitor.sh;;
  364. ta|test-alert)
  365. command_test_alert.sh;;
  366. dt|details)
  367. command_details.sh;;
  368. pd|postdetails)
  369. command_postdetails.sh;;
  370. b|backup)
  371. command_backup.sh;;
  372. c|console)
  373. command_console.sh;;
  374. d|debug)
  375. command_debug.sh;;
  376. dev|dev-debug)
  377. command_dev_debug.sh;;
  378. i|install)
  379. command_install.sh;;
  380. ir|install-default-resources)
  381. command_install_resources_mta.sh;;
  382. ai|auto-install)
  383. fn_autoinstall;;
  384. dd|detect-deps)
  385. command_dev_detect_deps.sh;;
  386. dg|detect-glibc)
  387. command_dev_detect_glibc.sh;;
  388. dl|detect-ldd)
  389. command_dev_detect_ldd.sh;;
  390. *)
  391. if [ -n "${getopt}" ]; then
  392. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  393. exitcode=2
  394. fi
  395. echo "Usage: $0 [option]"
  396. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  397. echo "https://gameservermanagers.com/${selfname}"
  398. echo -e ""
  399. echo -e "${lightyellow}Commands${default}"
  400. {
  401. echo -e "${blue}start\t${default}st |Start the server."
  402. echo -e "${blue}stop\t${default}sp |Stop the server."
  403. echo -e "${blue}restart\t${default}r |Restart the server."
  404. echo -e "${blue}update\t${default}u |Checks and applies updates from linux.mtasa.com."
  405. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from linux.mtasa.com."
  406. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  407. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  408. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  409. echo -e "${blue}details\t${default}dt |Displays useful infomation about the server."
  410. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  411. echo -e "${blue}backup\t${default}b |Create archive of the server."
  412. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  413. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  414. echo -e "${blue}install\t${default}i |Install the server."
  415. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  416. echo -e "${blue}install-default-resources\t${default}ir |Install the MTA default resources."
  417. } | column -s $'\t' -t
  418. esac
  419. }
  420. fn_getopt_mumble(){
  421. case "${getopt}" in
  422. st|start)
  423. command_start.sh;;
  424. sp|stop)
  425. command_stop.sh;;
  426. r|restart)
  427. command_restart.sh;;
  428. u|update)
  429. command_update.sh;;
  430. uf|update-functions)
  431. command_update_functions.sh;;
  432. m|monitor)
  433. command_monitor.sh;;
  434. ta|test-alert)
  435. command_test_alert.sh;;
  436. dt|details)
  437. command_details.sh;;
  438. pd|postdetails)
  439. command_postdetails.sh;;
  440. b|backup)
  441. command_backup.sh;;
  442. dev|dev-debug)
  443. command_dev_debug.sh;;
  444. c|console)
  445. command_console.sh;;
  446. i|install)
  447. command_install.sh;;
  448. dd|detect-deps)
  449. command_dev_detect_deps.sh;;
  450. dg|detect-glibc)
  451. command_dev_detect_glibc.sh;;
  452. dl|detect-ldd)
  453. command_dev_detect_ldd.sh;;
  454. *)
  455. if [ -n "${getopt}" ]; then
  456. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  457. exitcode=2
  458. fi
  459. echo "Usage: $0 [option]"
  460. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  461. echo "https://gameservermanagers.com/${selfname}"
  462. echo -e ""
  463. echo -e "${lightyellow}Commands${default}"
  464. {
  465. echo -e "${blue}start\t${default}st |Start the server."
  466. echo -e "${blue}stop\t${default}sp |Stop the server."
  467. echo -e "${blue}restart\t${default}r |Restart the server."
  468. echo -e "${blue}update\t${default}u |Checks and applies updates from GitHub."
  469. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  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}debug\t${default}d |See the output of the server directly to your terminal."
  476. echo -e "${blue}install\t${default}i |Install the server."
  477. } | column -s $'\t' -t
  478. esac
  479. }
  480. fn_getopt_dstserver(){
  481. case "${getopt}" in
  482. st|start)
  483. command_start.sh;;
  484. sp|stop)
  485. command_stop.sh;;
  486. r|restart)
  487. command_restart.sh;;
  488. u|update)
  489. command_update.sh;;
  490. fu|force-update|update-restart)
  491. forceupdate=1;
  492. command_update.sh;;
  493. uf|update-functions)
  494. command_update_functions.sh;;
  495. v|validate)
  496. command_validate.sh;;
  497. m|monitor)
  498. command_monitor.sh;;
  499. ta|test-alert)
  500. command_test_alert.sh;;
  501. dt|details)
  502. command_details.sh;;
  503. pd|postdetails)
  504. command_postdetails.sh;;
  505. b|backup)
  506. command_backup.sh;;
  507. c|console)
  508. command_console.sh;;
  509. d|debug)
  510. command_debug.sh;;
  511. dev|dev-debug)
  512. command_dev_debug.sh;;
  513. i|install)
  514. command_install.sh;;
  515. ai|auto-install)
  516. fn_autoinstall;;
  517. ct|cluster-token)
  518. install_dst_token.sh;;
  519. dd|detect-deps)
  520. command_dev_detect_deps.sh;;
  521. dg|detect-glibc)
  522. command_dev_detect_glibc.sh;;
  523. dl|detect-ldd)
  524. command_dev_detect_ldd.sh;;
  525. *)
  526. if [ -n "${getopt}" ]; then
  527. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  528. exitcode=2
  529. fi
  530. echo "Usage: $0 [option]"
  531. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  532. echo "https://gameservermanagers.com/${selfname}"
  533. echo -e ""
  534. echo -e "${lightyellow}Commands${default}"
  535. {
  536. echo -e "${blue}start\t${default}st |Start the server."
  537. echo -e "${blue}stop\t${default}sp |Stop the server."
  538. echo -e "${blue}restart\t${default}r |Restart the server."
  539. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  540. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  541. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  542. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  543. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  544. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  545. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  546. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  547. echo -e "${blue}backup\t${default}b |Create archive of the server."
  548. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  549. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  550. echo -e "${blue}install\t${default}i |Install the server."
  551. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  552. echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
  553. } | column -s $'\t' -t
  554. esac
  555. }
  556. fn_getopt_gmodserver(){
  557. case "${getopt}" in
  558. st|start)
  559. command_start.sh;;
  560. sp|stop)
  561. command_stop.sh;;
  562. r|restart)
  563. command_restart.sh;;
  564. u|update)
  565. command_update.sh;;
  566. fu|force-update|update-restart)
  567. forceupdate=1;
  568. command_update.sh;;
  569. uf|update-functions)
  570. command_update_functions.sh;;
  571. v|validate)
  572. command_validate.sh;;
  573. m|monitor)
  574. command_monitor.sh;;
  575. ta|test-alert)
  576. command_test_alert.sh;;
  577. dt|details)
  578. command_details.sh;;
  579. pd|postdetails)
  580. command_postdetails.sh;;
  581. b|backup)
  582. command_backup.sh;;
  583. c|console)
  584. command_console.sh;;
  585. d|debug)
  586. command_debug.sh;;
  587. dev|dev-debug)
  588. command_dev_debug.sh;;
  589. i|install)
  590. command_install.sh;;
  591. ai|auto-install)
  592. fn_autoinstall;;
  593. fd|fastdl)
  594. command_fastdl.sh;;
  595. mi|mods-install)
  596. command_mods_install.sh;;
  597. mu|mods-update)
  598. command_mods_update.sh;;
  599. mr|mods-remove)
  600. command_mods_remove.sh;;
  601. dd|detect-deps)
  602. command_dev_detect_deps.sh;;
  603. dg|detect-glibc)
  604. command_dev_detect_glibc.sh;;
  605. dl|detect-ldd)
  606. command_dev_detect_ldd.sh;;
  607. *)
  608. if [ -n "${getopt}" ]; then
  609. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  610. exitcode=2
  611. fi
  612. echo "Usage: $0 [option]"
  613. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  614. echo "https://gameservermanagers.com/${selfname}"
  615. echo -e ""
  616. echo -e "${lightyellow}Commands${default}"
  617. {
  618. echo -e "${blue}start\t${default}st |Start the server."
  619. echo -e "${blue}stop\t${default}sp |Stop the server."
  620. echo -e "${blue}restart\t${default}r |Restart the server."
  621. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  622. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  623. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  624. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  625. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  626. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  627. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  628. echo -e "${blue}backup\t${default}b |Create archive of the server."
  629. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  630. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  631. echo -e "${blue}install\t${default}i |Install the server."
  632. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  633. echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
  634. echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
  635. echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
  636. echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
  637. } | column -s $'\t' -t
  638. esac
  639. }
  640. fn_getopt_unreal(){
  641. case "${getopt}" in
  642. st|start)
  643. command_start.sh;;
  644. sp|stop)
  645. command_stop.sh;;
  646. r|restart)
  647. command_restart.sh;;
  648. uf|update-functions)
  649. command_update_functions.sh;;
  650. m|monitor)
  651. command_monitor.sh;;
  652. ta|test-alert)
  653. command_test_alert.sh;;
  654. dt|details)
  655. command_details.sh;;
  656. b|backup)
  657. command_backup.sh;;
  658. c|console)
  659. command_console.sh;;
  660. d|debug)
  661. command_debug.sh;;
  662. dev|dev-debug)
  663. command_dev_debug.sh;;
  664. i|install)
  665. command_install.sh;;
  666. ai|auto-install)
  667. fn_autoinstall;;
  668. mc|map-compressor)
  669. compress_ut99_maps.sh;;
  670. dd|detect-deps)
  671. command_dev_detect_deps.sh;;
  672. dg|detect-glibc)
  673. command_dev_detect_glibc.sh;;
  674. dl|detect-ldd)
  675. command_dev_detect_ldd.sh;;
  676. *)
  677. if [ -n "${getopt}" ]; then
  678. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  679. exitcode=2
  680. fi
  681. echo "Usage: $0 [option]"
  682. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  683. echo "https://gameservermanagers.com/${selfname}"
  684. echo -e ""
  685. echo -e "${lightyellow}Commands${default}"
  686. {
  687. echo -e "${blue}start\t${default}st |Start the server."
  688. echo -e "${blue}stop\t${default}sp |Stop the server."
  689. echo -e "${blue}restart\t${default}r |Restart the server."
  690. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  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_unreal2(){
  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. u|update)
  712. command_update.sh;;
  713. fu|force-update|update-restart)
  714. forceupdate=1;
  715. command_update.sh;;
  716. uf|update-functions)
  717. command_update_functions.sh;;
  718. v|validate)
  719. command_validate.sh;;
  720. m|monitor)
  721. command_monitor.sh;;
  722. ta|test-alert)
  723. command_test_alert.sh;;
  724. dt|details)
  725. command_details.sh;;
  726. b|backup)
  727. command_backup.sh;;
  728. c|console)
  729. command_console.sh;;
  730. d|debug)
  731. command_debug.sh;;
  732. dev|dev-debug)
  733. command_dev_debug.sh;;
  734. i|install)
  735. command_install.sh;;
  736. ai|auto-install)
  737. fn_autoinstall;;
  738. dd|detect-deps)
  739. command_dev_detect_deps.sh;;
  740. dg|detect-glibc)
  741. command_dev_detect_glibc.sh;;
  742. dl|detect-ldd)
  743. command_dev_detect_ldd.sh;;
  744. mc|map-compressor)
  745. compress_unreal2_maps.sh;;
  746. *)
  747. if [ -n "${getopt}" ]; then
  748. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  749. exitcode=2
  750. fi
  751. echo "Usage: $0 [option]"
  752. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  753. echo "https://gameservermanagers.com/${selfname}"
  754. echo -e ""
  755. echo -e "${lightyellow}Commands${default}"
  756. {
  757. echo -e "${blue}start\t${default}st |Start the server."
  758. echo -e "${blue}stop\t${default}sp |Stop the server."
  759. echo -e "${blue}restart\t${default}r |Restart the server."
  760. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  761. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  762. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  763. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  764. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  765. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  766. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  767. echo -e "${blue}backup\t${default}b |Create archive of the server."
  768. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  769. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  770. echo -e "${blue}install\t${default}i |Install the server."
  771. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  772. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  773. } | column -s $'\t' -t
  774. esac
  775. }
  776. fn_getopt_ut2k4(){
  777. case "${getopt}" in
  778. st|start)
  779. command_start.sh;;
  780. sp|stop)
  781. command_stop.sh;;
  782. r|restart)
  783. command_restart.sh;;
  784. uf|update-functions)
  785. command_update_functions.sh;;
  786. m|monitor)
  787. command_monitor.sh;;
  788. ta|test-alert)
  789. command_test_alert.sh;;
  790. dt|details)
  791. command_details.sh;;
  792. b|backup)
  793. command_backup.sh;;
  794. c|console)
  795. command_console.sh;;
  796. d|debug)
  797. command_debug.sh;;
  798. dev|dev-debug)
  799. command_dev_debug.sh;;
  800. i|install)
  801. command_install.sh;;
  802. ai|auto-install)
  803. fn_autoinstall;;
  804. cd|server-cd-key)
  805. install_ut2k4_key.sh;;
  806. mc|map-compressor)
  807. compress_unreal2_maps.sh;;
  808. dd|detect-deps)
  809. command_dev_detect_deps.sh;;
  810. dg|detect-glibc)
  811. command_dev_detect_glibc.sh;;
  812. dl|detect-ldd)
  813. command_dev_detect_ldd.sh;;
  814. *)
  815. if [ -n "${getopt}" ]; then
  816. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  817. exitcode=2
  818. fi
  819. echo "Usage: $0 [option]"
  820. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  821. echo "https://gameservermanagers.com/${selfname}"
  822. echo -e ""
  823. echo -e "${lightyellow}Commands${default}"
  824. {
  825. echo -e "${blue}start\t${default}st |Start the server."
  826. echo -e "${blue}stop\t${default}sp |Stop the server."
  827. echo -e "${blue}restart\t${default}r |Restart the server."
  828. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  829. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  830. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  831. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  832. echo -e "${blue}backup\t${default}b |Create archive of the server."
  833. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  834. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  835. echo -e "${blue}install\t${default}i |Install the server."
  836. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  837. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  838. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  839. } | column -s $'\t' -t
  840. esac
  841. }
  842. # Don't Starve Together
  843. if [ "${gamename}" == "Don't Starve Together" ]; then
  844. fn_getopt_dstserver
  845. # Garry's Mod
  846. elif [ "${gamename}" == "Garry's Mod" ]; then
  847. fn_getopt_gmodserver
  848. # Minecraft
  849. elif [ "${engine}" == "lwjgl2" ]; then
  850. fn_getopt_minecraft
  851. # Multi Theft Auto
  852. elif [ "${gamename}" == "Multi Theft Auto" ]; then
  853. fn_getopt_mta
  854. # Mumble
  855. elif [ "${gamename}" == "Mumble" ]; then
  856. fn_getopt_mumble
  857. # Teamspeak 3
  858. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  859. fn_getopt_teamspeak3
  860. # Unreal 2 Engine
  861. elif [ "${engine}" == "unreal2" ]; then
  862. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  863. fn_getopt_ut2k4
  864. else
  865. fn_getopt_unreal2
  866. fi
  867. # Unreal Engine
  868. elif [ "${engine}" == "unreal" ]; then
  869. fn_getopt_unreal
  870. # Generic
  871. 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
  872. fn_getopt_generic_no_update
  873. elif [ "${gamename}" == "Factorio" ]; then
  874. fn_getopt_generic_update_no_steam
  875. else
  876. fn_getopt_generic
  877. fi
  878. core_exit.sh