core_getopt.sh 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  1. #!/bin/bash
  2. # LinuxGSM 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. d|debug)
  443. command_debug.sh;;
  444. dev|dev-debug)
  445. command_dev_debug.sh;;
  446. c|console)
  447. command_console.sh;;
  448. i|install)
  449. command_install.sh;;
  450. ai|auto-install)
  451. fn_autoinstall;;
  452. dd|detect-deps)
  453. command_dev_detect_deps.sh;;
  454. dg|detect-glibc)
  455. command_dev_detect_glibc.sh;;
  456. dl|detect-ldd)
  457. command_dev_detect_ldd.sh;;
  458. *)
  459. if [ -n "${getopt}" ]; then
  460. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  461. exitcode=2
  462. fi
  463. echo "Usage: $0 [option]"
  464. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  465. echo "https://gameservermanagers.com/${selfname}"
  466. echo -e ""
  467. echo -e "${lightyellow}Commands${default}"
  468. {
  469. echo -e "${blue}start\t${default}st |Start the server."
  470. echo -e "${blue}stop\t${default}sp |Stop the server."
  471. echo -e "${blue}restart\t${default}r |Restart the server."
  472. echo -e "${blue}update\t${default}u |Checks and applies updates from GitHub."
  473. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  474. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  475. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  476. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  477. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  478. echo -e "${blue}backup\t${default}b |Create archive of the server."
  479. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  480. echo -e "${blue}install\t${default}i |Install the server."
  481. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  482. } | column -s $'\t' -t
  483. esac
  484. }
  485. fn_getopt_dstserver(){
  486. case "${getopt}" in
  487. st|start)
  488. command_start.sh;;
  489. sp|stop)
  490. command_stop.sh;;
  491. r|restart)
  492. command_restart.sh;;
  493. u|update)
  494. command_update.sh;;
  495. fu|force-update|update-restart)
  496. forceupdate=1;
  497. command_update.sh;;
  498. uf|update-functions)
  499. command_update_functions.sh;;
  500. v|validate)
  501. command_validate.sh;;
  502. m|monitor)
  503. command_monitor.sh;;
  504. ta|test-alert)
  505. command_test_alert.sh;;
  506. dt|details)
  507. command_details.sh;;
  508. pd|postdetails)
  509. command_postdetails.sh;;
  510. b|backup)
  511. command_backup.sh;;
  512. c|console)
  513. command_console.sh;;
  514. d|debug)
  515. command_debug.sh;;
  516. dev|dev-debug)
  517. command_dev_debug.sh;;
  518. i|install)
  519. command_install.sh;;
  520. ai|auto-install)
  521. fn_autoinstall;;
  522. ct|cluster-token)
  523. install_dst_token.sh;;
  524. dd|detect-deps)
  525. command_dev_detect_deps.sh;;
  526. dg|detect-glibc)
  527. command_dev_detect_glibc.sh;;
  528. dl|detect-ldd)
  529. command_dev_detect_ldd.sh;;
  530. *)
  531. if [ -n "${getopt}" ]; then
  532. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  533. exitcode=2
  534. fi
  535. echo "Usage: $0 [option]"
  536. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  537. echo "https://gameservermanagers.com/${selfname}"
  538. echo -e ""
  539. echo -e "${lightyellow}Commands${default}"
  540. {
  541. echo -e "${blue}start\t${default}st |Start the server."
  542. echo -e "${blue}stop\t${default}sp |Stop the server."
  543. echo -e "${blue}restart\t${default}r |Restart the server."
  544. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  545. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  546. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  547. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  548. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  549. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  550. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  551. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  552. echo -e "${blue}backup\t${default}b |Create archive of the server."
  553. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  554. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  555. echo -e "${blue}install\t${default}i |Install the server."
  556. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  557. echo -e "${blue}cluster-token\t${default}ct |Configure cluster token."
  558. } | column -s $'\t' -t
  559. esac
  560. }
  561. fn_getopt_gmodserver(){
  562. case "${getopt}" in
  563. st|start)
  564. command_start.sh;;
  565. sp|stop)
  566. command_stop.sh;;
  567. r|restart)
  568. command_restart.sh;;
  569. u|update)
  570. command_update.sh;;
  571. fu|force-update|update-restart)
  572. forceupdate=1;
  573. command_update.sh;;
  574. uf|update-functions)
  575. command_update_functions.sh;;
  576. v|validate)
  577. command_validate.sh;;
  578. m|monitor)
  579. command_monitor.sh;;
  580. ta|test-alert)
  581. command_test_alert.sh;;
  582. dt|details)
  583. command_details.sh;;
  584. pd|postdetails)
  585. command_postdetails.sh;;
  586. b|backup)
  587. command_backup.sh;;
  588. c|console)
  589. command_console.sh;;
  590. d|debug)
  591. command_debug.sh;;
  592. dev|dev-debug)
  593. command_dev_debug.sh;;
  594. i|install)
  595. command_install.sh;;
  596. ai|auto-install)
  597. fn_autoinstall;;
  598. fd|fastdl)
  599. command_fastdl.sh;;
  600. mi|mods-install)
  601. command_mods_install.sh;;
  602. mu|mods-update)
  603. command_mods_update.sh;;
  604. mr|mods-remove)
  605. command_mods_remove.sh;;
  606. dd|detect-deps)
  607. command_dev_detect_deps.sh;;
  608. dg|detect-glibc)
  609. command_dev_detect_glibc.sh;;
  610. dl|detect-ldd)
  611. command_dev_detect_ldd.sh;;
  612. *)
  613. if [ -n "${getopt}" ]; then
  614. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  615. exitcode=2
  616. fi
  617. echo "Usage: $0 [option]"
  618. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  619. echo "https://gameservermanagers.com/${selfname}"
  620. echo -e ""
  621. echo -e "${lightyellow}Commands${default}"
  622. {
  623. echo -e "${blue}start\t${default}st |Start the server."
  624. echo -e "${blue}stop\t${default}sp |Stop the server."
  625. echo -e "${blue}restart\t${default}r |Restart the server."
  626. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  627. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  628. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  629. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  630. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  631. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  632. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  633. echo -e "${blue}backup\t${default}b |Create archive of the server."
  634. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  635. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  636. echo -e "${blue}install\t${default}i |Install the server."
  637. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  638. echo -e "${blue}fastdl\t${default}fd |Generates or update a FastDL directory for your server."
  639. echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
  640. echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
  641. echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
  642. } | column -s $'\t' -t
  643. esac
  644. }
  645. fn_getopt_rustserver(){
  646. case "${getopt}" in
  647. st|start)
  648. command_start.sh;;
  649. sp|stop)
  650. command_stop.sh;;
  651. r|restart)
  652. command_restart.sh;;
  653. u|update)
  654. command_update.sh;;
  655. fu|force-update|update-restart)
  656. forceupdate=1;
  657. command_update.sh;;
  658. uf|update-functions)
  659. command_update_functions.sh;;
  660. v|validate)
  661. command_validate.sh;;
  662. m|monitor)
  663. command_monitor.sh;;
  664. ta|test-alert)
  665. command_test_alert.sh;;
  666. dt|details)
  667. command_details.sh;;
  668. pd|postdetails)
  669. command_postdetails.sh;;
  670. b|backup)
  671. command_backup.sh;;
  672. c|console)
  673. command_console.sh;;
  674. d|debug)
  675. command_debug.sh;;
  676. dev|dev-debug)
  677. command_dev_debug.sh;;
  678. i|install)
  679. command_install.sh;;
  680. ai|auto-install)
  681. fn_autoinstall;;
  682. mi|mods-install)
  683. command_mods_install.sh;;
  684. mu|mods-update)
  685. command_mods_update.sh;;
  686. mr|mods-remove)
  687. command_mods_remove.sh;;
  688. wi|wipe)
  689. command_wipe.sh;;
  690. dd|detect-deps)
  691. command_dev_detect_deps.sh;;
  692. dg|detect-glibc)
  693. command_dev_detect_glibc.sh;;
  694. dl|detect-ldd)
  695. command_dev_detect_ldd.sh;;
  696. *)
  697. if [ -n "${getopt}" ]; then
  698. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  699. exitcode=2
  700. fi
  701. echo "Usage: $0 [option]"
  702. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  703. echo "https://gameservermanagers.com/${selfname}"
  704. echo -e ""
  705. echo -e "${lightyellow}Commands${default}"
  706. {
  707. echo -e "${blue}start\t${default}st |Start the server."
  708. echo -e "${blue}stop\t${default}sp |Stop the server."
  709. echo -e "${blue}restart\t${default}r |Restart the server."
  710. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  711. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  712. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  713. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  714. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  715. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  716. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  717. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  718. echo -e "${blue}backup\t${default}b |Create archive of the server."
  719. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  720. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  721. echo -e "${blue}install\t${default}i |Install the server."
  722. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  723. echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
  724. echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
  725. echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
  726. echo -e "${blue}wipe\t${default}wi |Wipe your Rust server."
  727. } | column -s $'\t' -t
  728. esac
  729. }
  730. fn_getopt_unreal(){
  731. case "${getopt}" in
  732. st|start)
  733. command_start.sh;;
  734. sp|stop)
  735. command_stop.sh;;
  736. r|restart)
  737. command_restart.sh;;
  738. uf|update-functions)
  739. command_update_functions.sh;;
  740. m|monitor)
  741. command_monitor.sh;;
  742. ta|test-alert)
  743. command_test_alert.sh;;
  744. dt|details)
  745. command_details.sh;;
  746. b|backup)
  747. command_backup.sh;;
  748. c|console)
  749. command_console.sh;;
  750. d|debug)
  751. command_debug.sh;;
  752. dev|dev-debug)
  753. command_dev_debug.sh;;
  754. i|install)
  755. command_install.sh;;
  756. ai|auto-install)
  757. fn_autoinstall;;
  758. mc|map-compressor)
  759. compress_ut99_maps.sh;;
  760. dd|detect-deps)
  761. command_dev_detect_deps.sh;;
  762. dg|detect-glibc)
  763. command_dev_detect_glibc.sh;;
  764. dl|detect-ldd)
  765. command_dev_detect_ldd.sh;;
  766. *)
  767. if [ -n "${getopt}" ]; then
  768. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  769. exitcode=2
  770. fi
  771. echo "Usage: $0 [option]"
  772. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  773. echo "https://gameservermanagers.com/${selfname}"
  774. echo -e ""
  775. echo -e "${lightyellow}Commands${default}"
  776. {
  777. echo -e "${blue}start\t${default}st |Start the server."
  778. echo -e "${blue}stop\t${default}sp |Stop the server."
  779. echo -e "${blue}restart\t${default}r |Restart the server."
  780. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  781. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  782. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  783. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  784. echo -e "${blue}backup\t${default}b |Create archive of the server."
  785. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  786. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  787. echo -e "${blue}install\t${default}i |Install the server."
  788. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  789. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  790. } | column -s $'\t' -t
  791. esac
  792. }
  793. fn_getopt_unreal2(){
  794. case "${getopt}" in
  795. st|start)
  796. command_start.sh;;
  797. sp|stop)
  798. command_stop.sh;;
  799. r|restart)
  800. command_restart.sh;;
  801. u|update)
  802. command_update.sh;;
  803. fu|force-update|update-restart)
  804. forceupdate=1;
  805. command_update.sh;;
  806. uf|update-functions)
  807. command_update_functions.sh;;
  808. v|validate)
  809. command_validate.sh;;
  810. m|monitor)
  811. command_monitor.sh;;
  812. ta|test-alert)
  813. command_test_alert.sh;;
  814. dt|details)
  815. command_details.sh;;
  816. b|backup)
  817. command_backup.sh;;
  818. c|console)
  819. command_console.sh;;
  820. d|debug)
  821. command_debug.sh;;
  822. dev|dev-debug)
  823. command_dev_debug.sh;;
  824. i|install)
  825. command_install.sh;;
  826. ai|auto-install)
  827. fn_autoinstall;;
  828. dd|detect-deps)
  829. command_dev_detect_deps.sh;;
  830. dg|detect-glibc)
  831. command_dev_detect_glibc.sh;;
  832. dl|detect-ldd)
  833. command_dev_detect_ldd.sh;;
  834. mc|map-compressor)
  835. compress_unreal2_maps.sh;;
  836. *)
  837. if [ -n "${getopt}" ]; then
  838. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  839. exitcode=2
  840. fi
  841. echo "Usage: $0 [option]"
  842. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  843. echo "https://gameservermanagers.com/${selfname}"
  844. echo -e ""
  845. echo -e "${lightyellow}Commands${default}"
  846. {
  847. echo -e "${blue}start\t${default}st |Start the server."
  848. echo -e "${blue}stop\t${default}sp |Stop the server."
  849. echo -e "${blue}restart\t${default}r |Restart the server."
  850. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  851. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  852. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  853. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  854. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  855. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  856. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  857. echo -e "${blue}backup\t${default}b |Create archive of the server."
  858. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  859. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  860. echo -e "${blue}install\t${default}i |Install the server."
  861. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  862. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  863. } | column -s $'\t' -t
  864. esac
  865. }
  866. fn_getopt_ut2k4(){
  867. case "${getopt}" in
  868. st|start)
  869. command_start.sh;;
  870. sp|stop)
  871. command_stop.sh;;
  872. r|restart)
  873. command_restart.sh;;
  874. uf|update-functions)
  875. command_update_functions.sh;;
  876. m|monitor)
  877. command_monitor.sh;;
  878. ta|test-alert)
  879. command_test_alert.sh;;
  880. dt|details)
  881. command_details.sh;;
  882. b|backup)
  883. command_backup.sh;;
  884. c|console)
  885. command_console.sh;;
  886. d|debug)
  887. command_debug.sh;;
  888. dev|dev-debug)
  889. command_dev_debug.sh;;
  890. i|install)
  891. command_install.sh;;
  892. ai|auto-install)
  893. fn_autoinstall;;
  894. cd|server-cd-key)
  895. install_ut2k4_key.sh;;
  896. mc|map-compressor)
  897. compress_unreal2_maps.sh;;
  898. dd|detect-deps)
  899. command_dev_detect_deps.sh;;
  900. dg|detect-glibc)
  901. command_dev_detect_glibc.sh;;
  902. dl|detect-ldd)
  903. command_dev_detect_ldd.sh;;
  904. *)
  905. if [ -n "${getopt}" ]; then
  906. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  907. exitcode=2
  908. fi
  909. echo "Usage: $0 [option]"
  910. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  911. echo "https://gameservermanagers.com/${selfname}"
  912. echo -e ""
  913. echo -e "${lightyellow}Commands${default}"
  914. {
  915. echo -e "${blue}start\t${default}st |Start the server."
  916. echo -e "${blue}stop\t${default}sp |Stop the server."
  917. echo -e "${blue}restart\t${default}r |Restart the server."
  918. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  919. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  920. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  921. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  922. echo -e "${blue}backup\t${default}b |Create archive of the server."
  923. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  924. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  925. echo -e "${blue}install\t${default}i |Install the server."
  926. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  927. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  928. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  929. } | column -s $'\t' -t
  930. esac
  931. }
  932. # Don't Starve Together
  933. if [ "${gamename}" == "Don't Starve Together" ]; then
  934. fn_getopt_dstserver
  935. # Garry's Mod
  936. elif [ "${gamename}" == "Garry's Mod" ]; then
  937. fn_getopt_gmodserver
  938. # Minecraft
  939. elif [ "${engine}" == "lwjgl2" ]; then
  940. fn_getopt_minecraft
  941. # Multi Theft Auto
  942. elif [ "${gamename}" == "Multi Theft Auto" ]; then
  943. fn_getopt_mta
  944. # Mumble
  945. elif [ "${gamename}" == "Mumble" ]; then
  946. fn_getopt_mumble
  947. # Teamspeak 3
  948. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  949. fn_getopt_teamspeak3
  950. elif [ "${gamename}" == "Rust" ]; then
  951. fn_getopt_rustserver
  952. # Unreal 2 Engine
  953. elif [ "${engine}" == "unreal2" ]; then
  954. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  955. fn_getopt_ut2k4
  956. else
  957. fn_getopt_unreal2
  958. fi
  959. # Unreal Engine
  960. elif [ "${engine}" == "unreal" ]; then
  961. fn_getopt_unreal
  962. # Generic
  963. 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
  964. fn_getopt_generic_no_update
  965. elif [ "${gamename}" == "Factorio" ]; then
  966. fn_getopt_generic_update_no_steam
  967. else
  968. fn_getopt_generic
  969. fi
  970. core_exit.sh