core_getopt.sh 32 KB

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