core_getopt.sh 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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. 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_rustserver(){
  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. u|update)
  649. command_update.sh;;
  650. fu|force-update|update-restart)
  651. forceupdate=1;
  652. command_update.sh;;
  653. uf|update-functions)
  654. command_update_functions.sh;;
  655. v|validate)
  656. command_validate.sh;;
  657. m|monitor)
  658. command_monitor.sh;;
  659. ta|test-alert)
  660. command_test_alert.sh;;
  661. dt|details)
  662. command_details.sh;;
  663. pd|postdetails)
  664. command_postdetails.sh;;
  665. b|backup)
  666. command_backup.sh;;
  667. c|console)
  668. command_console.sh;;
  669. d|debug)
  670. command_debug.sh;;
  671. dev|dev-debug)
  672. command_dev_debug.sh;;
  673. i|install)
  674. command_install.sh;;
  675. ai|auto-install)
  676. fn_autoinstall;;
  677. mi|mods-install)
  678. command_mods_install.sh;;
  679. mu|mods-update)
  680. command_mods_update.sh;;
  681. mr|mods-remove)
  682. command_mods_remove.sh;;
  683. wi|wipe)
  684. command_wipe.sh;;
  685. dd|detect-deps)
  686. command_dev_detect_deps.sh;;
  687. dg|detect-glibc)
  688. command_dev_detect_glibc.sh;;
  689. dl|detect-ldd)
  690. command_dev_detect_ldd.sh;;
  691. *)
  692. if [ -n "${getopt}" ]; then
  693. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  694. exitcode=2
  695. fi
  696. echo "Usage: $0 [option]"
  697. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  698. echo "https://gameservermanagers.com/${selfname}"
  699. echo -e ""
  700. echo -e "${lightyellow}Commands${default}"
  701. {
  702. echo -e "${blue}start\t${default}st |Start the server."
  703. echo -e "${blue}stop\t${default}sp |Stop the server."
  704. echo -e "${blue}restart\t${default}r |Restart the server."
  705. echo -e "${blue}update\t${default}u |Checks and applies updates from SteamCMD."
  706. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  707. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  708. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  709. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  710. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  711. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  712. echo -e "${blue}postdetails\t${default}pd |Post stripped details to pastebin (for support)"
  713. echo -e "${blue}backup\t${default}b |Create archive of the server."
  714. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  715. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  716. echo -e "${blue}install\t${default}i |Install the server."
  717. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  718. echo -e "${blue}mods-install\t${default}mi |View and install available mods/addons."
  719. echo -e "${blue}mods-update\t${default}mu |Update installed mods/addons."
  720. echo -e "${blue}mods-remove\t${default}mr |Remove installed mods/addons."
  721. echo -e "${blue}wipe\t${default}wi |Wipe your Rust server."
  722. } | column -s $'\t' -t
  723. esac
  724. }
  725. fn_getopt_unreal(){
  726. case "${getopt}" in
  727. st|start)
  728. command_start.sh;;
  729. sp|stop)
  730. command_stop.sh;;
  731. r|restart)
  732. command_restart.sh;;
  733. uf|update-functions)
  734. command_update_functions.sh;;
  735. m|monitor)
  736. command_monitor.sh;;
  737. ta|test-alert)
  738. command_test_alert.sh;;
  739. dt|details)
  740. command_details.sh;;
  741. b|backup)
  742. command_backup.sh;;
  743. c|console)
  744. command_console.sh;;
  745. d|debug)
  746. command_debug.sh;;
  747. dev|dev-debug)
  748. command_dev_debug.sh;;
  749. i|install)
  750. command_install.sh;;
  751. ai|auto-install)
  752. fn_autoinstall;;
  753. mc|map-compressor)
  754. compress_ut99_maps.sh;;
  755. dd|detect-deps)
  756. command_dev_detect_deps.sh;;
  757. dg|detect-glibc)
  758. command_dev_detect_glibc.sh;;
  759. dl|detect-ldd)
  760. command_dev_detect_ldd.sh;;
  761. *)
  762. if [ -n "${getopt}" ]; then
  763. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  764. exitcode=2
  765. fi
  766. echo "Usage: $0 [option]"
  767. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  768. echo "https://gameservermanagers.com/${selfname}"
  769. echo -e ""
  770. echo -e "${lightyellow}Commands${default}"
  771. {
  772. echo -e "${blue}start\t${default}st |Start the server."
  773. echo -e "${blue}stop\t${default}sp |Stop the server."
  774. echo -e "${blue}restart\t${default}r |Restart the server."
  775. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  776. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  777. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  778. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  779. echo -e "${blue}backup\t${default}b |Create archive of the server."
  780. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  781. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  782. echo -e "${blue}install\t${default}i |Install the server."
  783. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  784. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  785. } | column -s $'\t' -t
  786. esac
  787. }
  788. fn_getopt_unreal2(){
  789. case "${getopt}" in
  790. st|start)
  791. command_start.sh;;
  792. sp|stop)
  793. command_stop.sh;;
  794. r|restart)
  795. command_restart.sh;;
  796. u|update)
  797. command_update.sh;;
  798. fu|force-update|update-restart)
  799. forceupdate=1;
  800. command_update.sh;;
  801. uf|update-functions)
  802. command_update_functions.sh;;
  803. v|validate)
  804. command_validate.sh;;
  805. m|monitor)
  806. command_monitor.sh;;
  807. ta|test-alert)
  808. command_test_alert.sh;;
  809. dt|details)
  810. command_details.sh;;
  811. b|backup)
  812. command_backup.sh;;
  813. c|console)
  814. command_console.sh;;
  815. d|debug)
  816. command_debug.sh;;
  817. dev|dev-debug)
  818. command_dev_debug.sh;;
  819. i|install)
  820. command_install.sh;;
  821. ai|auto-install)
  822. fn_autoinstall;;
  823. dd|detect-deps)
  824. command_dev_detect_deps.sh;;
  825. dg|detect-glibc)
  826. command_dev_detect_glibc.sh;;
  827. dl|detect-ldd)
  828. command_dev_detect_ldd.sh;;
  829. mc|map-compressor)
  830. compress_unreal2_maps.sh;;
  831. *)
  832. if [ -n "${getopt}" ]; then
  833. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  834. exitcode=2
  835. fi
  836. echo "Usage: $0 [option]"
  837. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  838. echo "https://gameservermanagers.com/${selfname}"
  839. echo -e ""
  840. echo -e "${lightyellow}Commands${default}"
  841. {
  842. echo -e "${blue}start\t${default}st |Start the server."
  843. echo -e "${blue}stop\t${default}sp |Stop the server."
  844. echo -e "${blue}restart\t${default}r |Restart the server."
  845. echo -e "${blue}update\t${default}Checks and applies updates from SteamCMD."
  846. echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from SteamCMD."
  847. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  848. echo -e "${blue}validate\t${default}v |Validate server files with SteamCMD."
  849. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  850. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  851. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  852. echo -e "${blue}backup\t${default}b |Create archive of the server."
  853. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  854. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  855. echo -e "${blue}install\t${default}i |Install the server."
  856. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  857. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  858. } | column -s $'\t' -t
  859. esac
  860. }
  861. fn_getopt_ut2k4(){
  862. case "${getopt}" in
  863. st|start)
  864. command_start.sh;;
  865. sp|stop)
  866. command_stop.sh;;
  867. r|restart)
  868. command_restart.sh;;
  869. uf|update-functions)
  870. command_update_functions.sh;;
  871. m|monitor)
  872. command_monitor.sh;;
  873. ta|test-alert)
  874. command_test_alert.sh;;
  875. dt|details)
  876. command_details.sh;;
  877. b|backup)
  878. command_backup.sh;;
  879. c|console)
  880. command_console.sh;;
  881. d|debug)
  882. command_debug.sh;;
  883. dev|dev-debug)
  884. command_dev_debug.sh;;
  885. i|install)
  886. command_install.sh;;
  887. ai|auto-install)
  888. fn_autoinstall;;
  889. cd|server-cd-key)
  890. install_ut2k4_key.sh;;
  891. mc|map-compressor)
  892. compress_unreal2_maps.sh;;
  893. dd|detect-deps)
  894. command_dev_detect_deps.sh;;
  895. dg|detect-glibc)
  896. command_dev_detect_glibc.sh;;
  897. dl|detect-ldd)
  898. command_dev_detect_ldd.sh;;
  899. *)
  900. if [ -n "${getopt}" ]; then
  901. echo -e "${red}Unknown command${default}: $0 ${getopt}"
  902. exitcode=2
  903. fi
  904. echo "Usage: $0 [option]"
  905. echo "${gamename} - Linux Game Server Manager - Version ${version}"
  906. echo "https://gameservermanagers.com/${selfname}"
  907. echo -e ""
  908. echo -e "${lightyellow}Commands${default}"
  909. {
  910. echo -e "${blue}start\t${default}st |Start the server."
  911. echo -e "${blue}stop\t${default}sp |Stop the server."
  912. echo -e "${blue}restart\t${default}r |Restart the server."
  913. echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
  914. echo -e "${blue}monitor\t${default}m |Checks that the server is running."
  915. echo -e "${blue}test-alert\t${default}ta |Sends test alert."
  916. echo -e "${blue}details\t${default}dt |Displays useful information about the server."
  917. echo -e "${blue}backup\t${default}b |Create archive of the server."
  918. echo -e "${blue}console\t${default}c |Console allows you to access the live view of a server."
  919. echo -e "${blue}debug\t${default}d |See the output of the server directly to your terminal."
  920. echo -e "${blue}install\t${default}i |Install the server."
  921. echo -e "${blue}auto-install\t${default}ai |Install the server, without prompts."
  922. echo -e "${blue}server-cd-key\t${default}cd |Add your server cd key"
  923. echo -e "${blue}map-compressor\t${default}mc |Compresses all ${gamename} server maps."
  924. } | column -s $'\t' -t
  925. esac
  926. }
  927. # Don't Starve Together
  928. if [ "${gamename}" == "Don't Starve Together" ]; then
  929. fn_getopt_dstserver
  930. # Garry's Mod
  931. elif [ "${gamename}" == "Garry's Mod" ]; then
  932. fn_getopt_gmodserver
  933. # Minecraft
  934. elif [ "${engine}" == "lwjgl2" ]; then
  935. fn_getopt_minecraft
  936. # Multi Theft Auto
  937. elif [ "${gamename}" == "Multi Theft Auto" ]; then
  938. fn_getopt_mta
  939. # Mumble
  940. elif [ "${gamename}" == "Mumble" ]; then
  941. fn_getopt_mumble
  942. # Teamspeak 3
  943. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  944. fn_getopt_teamspeak3
  945. elif [ "${gamename}" == "Rust" ]; then
  946. fn_getopt_rustserver
  947. # Unreal 2 Engine
  948. elif [ "${engine}" == "unreal2" ]; then
  949. if [ "${gamename}" == "Unreal Tournament 2004" ]; then
  950. fn_getopt_ut2k4
  951. else
  952. fn_getopt_unreal2
  953. fi
  954. # Unreal Engine
  955. elif [ "${engine}" == "unreal" ]; then
  956. fn_getopt_unreal
  957. # Generic
  958. 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
  959. fn_getopt_generic_no_update
  960. elif [ "${gamename}" == "Factorio" ]; then
  961. fn_getopt_generic_update_no_steam
  962. else
  963. fn_getopt_generic
  964. fi
  965. core_exit.sh