Skip to content

Commit 9b62bde

Browse files
authored
feat(dev): add new developer command for parsing distro details (#4523)
* feat(dev): add new developer command for parsing distro details * Updated details-check action to match new command name
1 parent 181c845 commit 9b62bde

File tree

6 files changed

+284
-102
lines changed

6 files changed

+284
-102
lines changed

.github/workflows/details-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details
8484

8585
- name: Detect details
86-
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server detect-details
86+
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server parse-game-details
8787

8888
- name: Query Raw
8989
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server query-raw

lgsm/modules/command_dev_details.sh

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/bin/bash
2+
# LinuxGSM command_dev_parse_distro_details.sh module
3+
# Author: Daniel Gibbs
4+
# Contributors: http://linuxgsm.com/contrib
5+
# Website: https://linuxgsm.com
6+
# Description: Display parsed distro details.
7+
8+
check_ip.sh
9+
check_status.sh
10+
info_distro.sh
11+
12+
# Create an associative array of the server details.
13+
declare -A server_details=(
14+
['.NET Version']="${dotnetversion}"
15+
['Arch']="${arch}"
16+
['Backup Count']="${backupcount}"
17+
['Backup Last Date']="${lastbackupdate}"
18+
['Backup Last Days Ago']="${lastbackupdaysago}"
19+
['Backup Last Size']="${lastbackupsize}"
20+
['Backup Last']="${lastbackup}"
21+
['CPU Average Load']="${load}"
22+
['CPU Cores']="${cpucores}"
23+
['CPU Frequency']="${cpufreqency}"
24+
['CPU Model']="${cpumodel}"
25+
['Distro Codename']="${distrocodename}"
26+
['Distro ID Like']="${distroidlike}"
27+
['Distro ID']="${distroid}"
28+
['Distro Kernel']="${kernel}"
29+
['Distro Name']="${distroname}"
30+
['Distro Version CSV']="${distroversioncsv}"
31+
['Distro Version RH']="${distroversionrh}"
32+
['Distro Version']="${distroversion}"
33+
['Distro-Info Support']="${distrosupport}"
34+
['File System']="${filesystem}"
35+
['Game Server PID']="${gameserverpid}"
36+
['Gameserver CPU Used MHz']="${cpuusedmhz}"
37+
['Gameserver CPU Used']="${cpuused}"
38+
['Gameserver Mem Used MB']="${memusedmb}"
39+
['Gameserver Mem Used Pct']="${memusedpct}"
40+
['GLIBC Version']="${glibcversion}"
41+
['GLIBC']="${glibc}"
42+
['HLDS Linux PID']="${hldslinuxpid}"
43+
['Java Version']="${javaversion}"
44+
['Mono Version']="${monoversion}"
45+
['Network Interface']="${netint}"
46+
['Network Link Speed']="${netlink}"
47+
['Old Free']="${oldfree}"
48+
['Phys Mem Available']="${physmemavailable}"
49+
['Phys Mem Buffers KB']="${physmembufferskb}"
50+
['Phys Mem Cached']="${physmemcached}"
51+
['Phys Mem Free']="${physmemfree}"
52+
['Phys Mem Reclaimable KB']="${physmemreclaimablekb}"
53+
['Phys Mem Total GB']="${physmemtotalgb}"
54+
['Phys Mem Used']="${physmemused}"
55+
['Size Backup Dir']="${backupdirdu}"
56+
['Size Root Dir ']="${rootdirdu}"
57+
['Size Root Dir Excl. Backup']="${rootdirduexbackup}"
58+
['Size Serverfiles']="${serverfilesdu}"
59+
['SRCDS Linux PID']="${srcdslinuxpid}"
60+
['Storage Available']="${availspace}"
61+
['Storage Total']="${totalspace}"
62+
['Storage Used']="${usedspace}"
63+
['Swap Free']="${swapfree}"
64+
['Swap Total']="${swaptotal}"
65+
['Swap Used']="${swapused}"
66+
['Tmux Version']="${tmuxversion}"
67+
['Uptime Days']="${days}"
68+
['Uptime Hours']="${hours}"
69+
['Uptime Minutes']="${minutes}"
70+
['Uptime Total Seconds']="${uptime}"
71+
['Virtual Environment']="${virtualenvironment}"
72+
# ['Distro Info Array']="${distro_info_array}"
73+
# ['Distros Unsupported Array']="${distrosunsupported_array}"
74+
# ['Distros Unsupported']="${distrosunsupported}"
75+
# ['Human Readable']="${humanreadable}"
76+
# ['Phys Mem Actual Free KB']="${physmemactualfreekb}"
77+
# ['Phys Mem Cached KB']="${physmemcachedkb}"
78+
# ['Phys Mem Free KB']="${physmemfreekb}"
79+
# ['Phys Mem Total KB']="${physmemtotalkb}"
80+
# ['Phys Mem Total MB']="${physmemtotalmb}"
81+
# ['SS Info']="${ssinfo}"
82+
)
83+
84+
# Initialize variables to keep track of available and missing distro details.
85+
available_details=""
86+
missing_details=""
87+
88+
# Loop through the distro details and store them.
89+
for key in "${!server_details[@]}"; do
90+
value=${server_details[$key]}
91+
if [ -n "$value" ]; then
92+
available_details+="${lightblue}${key}: ${default}${value}\n"
93+
else
94+
missing_details+="${key}\n"
95+
fi
96+
done
97+
98+
# Sort and output the available distro details.
99+
if [ -n "$available_details" ]; then
100+
echo -e ""
101+
echo -e "${bold}${lightgreen}Available Distro Details${default}"
102+
fn_messages_separator
103+
echo -e "${available_details}" | sort
104+
fi
105+
106+
# Sort and output the missing distro details.
107+
if [ -n "$missing_details" ]; then
108+
echo -e ""
109+
echo -e "${lightgreen}Missing or unsupported Distro Details${default}"
110+
fn_messages_separator
111+
echo -e "${missing_details}" | sort
112+
fi
113+
114+
core_exit.sh
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#!/bin/bash
2+
# LinuxGSM command_dev_parse_game_details.sh module
3+
# Author: Daniel Gibbs
4+
# Contributors: http://linuxgsm.com/contrib
5+
# Website: https://linuxgsm.com
6+
# Description: Display parsed gameserver details.
7+
8+
if [ -f "config" ]; then
9+
servercfgfullpath="config"
10+
fi
11+
if [ -f "clusterconfig" ]; then
12+
clustercfgfullpath="clusterconfig"
13+
fi
14+
15+
info_game.sh
16+
17+
carriagereturn=$(file -b "${servercfgfullpath}" | grep -q CRLF && echo "${red}CRLF${default}" || echo "${lightgreen}LF${default}")
18+
19+
echo -e ""
20+
echo -e "${bold}${lightgreen}Server Details${default}"
21+
fn_messages_separator
22+
23+
echo -e ""
24+
echo -e "${lightblue}Game: ${default}${gamename}"
25+
echo -e "${lightblue}Config type: ${default}${configtype}"
26+
echo -e "${lightblue}Config file: ${default}${servercfgfullpath}"
27+
if [ -f "${clustercfgfullpath}" ]; then
28+
echo -e "${lightblue}Cluster config file: ${default}${clustercfgfullpath}"
29+
fi
30+
echo -e "${lightblue}Carriage Return: ${default}${carriagereturn}"
31+
32+
# Create an associative array of the server details.
33+
declare -A server_details=(
34+
['Admin Password']="${adminpassword}"
35+
['Alert IP']="${alertip}"
36+
['API Port']="${apiport}"
37+
['App Port']="${appport}"
38+
['ASE']="${ase}"
39+
['Auth Token']="${authtoken}"
40+
['BattleEye Port']="${battleeyeport}"
41+
['Beacon Port']="${beaconport}"
42+
['Cave']="${cave}"
43+
['Client Port']="${clientport}"
44+
['Cluster']="${cluster}"
45+
['Config IP']="${configip}"
46+
['Creative Mode']="${creativemode}"
47+
['Custom Level URL']="${customlevelurl}"
48+
['DB Plugin']="${dbplugin}"
49+
['Default Map']="${defaultmap}"
50+
['Default Scenario']="${defaultscenario}"
51+
['Display Master Server']="${displaymasterserver}"
52+
['Epic Settings']="${epicsettings}"
53+
['File Port']="${fileport}"
54+
['Files Port']="${filesport}"
55+
['Game Mode']="${gamemode}"
56+
['Game Type']="${gametype}"
57+
['Home Kingdom']="${homekingdom}"
58+
['Home Server']="${homeserver}"
59+
['HTTP Enabled']="${httpenabled}"
60+
['HTTP IP']="${httpip}"
61+
['HTTP Password']="${httppassword}"
62+
['HTTP Port']="${httpport}"
63+
['HTTP User']="${httpuser}"
64+
['Internet IP']="${publicip}"
65+
['LAN Port']="${lanport}"
66+
['Login Server']="${loginserver}"
67+
['Master Port']="${masterport}"
68+
['Master Server']="${masterserver}"
69+
['Master']="${master}"
70+
['Max Players']="${maxplayers}"
71+
['Mod Server Port']="${modserverport}"
72+
['OldQueryPortNumber']="${oldqueryportnumber}"
73+
['Password']="${password}"
74+
['Port 401']="${port401}"
75+
['Port IPv6']="${portipv6}"
76+
['Port']="${port}"
77+
['Query Enabled']="${queryenabled}"
78+
['Query HTTP Port']="${queryhttpport}"
79+
['Query HTTPS Port']="${queryhttpsport}"
80+
['Query Mode']="${querymode}"
81+
['Query Port GS']="${queryportgs}"
82+
['Query Port']="${queryport}"
83+
['Query SSH Port']="${querysshport}"
84+
['Queue Enabled']="${queueenabled}"
85+
['Queue Port']="${queueport}"
86+
['Random Map']="${randommap}"
87+
['Raw Port']="${rawport}"
88+
['RC Password']="${rcpassword}"
89+
['RCON Enabled']="${rconenabled}"
90+
['RCON Password']="${rconpassword}"
91+
['RCON Port']="${rconport}"
92+
['RCON Web']="${rconweb}"
93+
['Reserved Slots']="${reservedslots}"
94+
['RMI Port']="${rmiport}"
95+
['RMI Reg Port']="${rmiregport}"
96+
['Salt']="${salt}"
97+
['Save Game Interval']="${savegameinterval}"
98+
['Save Interval']="${saveinterval}"
99+
['Secondary Port']="${port3}"
100+
['Seed']="${seed}"
101+
['Server Description']="${serverdescription}"
102+
['Server IP']="${ip}"
103+
['Server Level']="${serverlevel}"
104+
['Server Name']="${servername}"
105+
['Server Password Enabled']="${serverpasswordenabled}"
106+
['Server Password']="${serverpassword}"
107+
['Server Version']="${serverversion}"
108+
['Shard']="${shard}"
109+
['Sharding']="${sharding}"
110+
['Shutdown Port']="${shutdownport}"
111+
['Stats Port']="${statsport}"
112+
['Steam Auth Port']="${steamauthport}"
113+
['Steam Port']="${steamport}"
114+
['Steamworks Port']="${steamworksport}"
115+
['Telnet Enabled']="${telnetenabled}"
116+
['Telnet IP']="${telnetip}"
117+
['Telnet Password']="${telnetpass}"
118+
['Telnet Password']="${telnetpassword}"
119+
['Telnet Port']="${telnetport}"
120+
['Tickrate']="${tickrate}"
121+
['Unknown Port']="${unknownport}"
122+
['Version Count']="${versioncount}"
123+
['Voice Port']="${voiceport}"
124+
['Voice Unused Port']="${voiceunusedport}"
125+
['World Name']="${worldname}"
126+
['World Size']="${worldsize}"
127+
['World Type']="${worldtype}"
128+
)
129+
130+
# Initialize variables to keep track of available and missing server details.
131+
available_details=""
132+
missing_details=""
133+
134+
# Loop through the server details and store them.
135+
for key in "${!server_details[@]}"; do
136+
value=${server_details[$key]}
137+
if [ -n "$value" ]; then
138+
available_details+="${lightblue}${key}: ${default}${value}\n"
139+
else
140+
missing_details+="${key}\n"
141+
fi
142+
done
143+
144+
# Sort and output the available distro details.
145+
if [ -n "$available_details" ]; then
146+
echo -e ""
147+
echo -e "${bold}${lightgreen}Available Distro Details${default}"
148+
fn_messages_separator
149+
echo -e "${available_details}" | sort
150+
fi
151+
152+
# Output the missing server details if there are any.
153+
if [ -n "$missing_details" ]; then
154+
echo -e ""
155+
echo -e "${lightgreen}Missing or unsupported Server Details${default}"
156+
fn_messages_separator
157+
echo -e "${missing_details}" | sort
158+
fi
159+
160+
core_exit.sh

0 commit comments

Comments
 (0)