Browse Source

Merge branch 'develop' into feature/ismgs

pull/4741/head
Daniel Gibbs 7 months ago
parent
commit
f92a0f2342
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 2
      .github/workflows/details-check-generate-matrix.sh
  2. 2
      lgsm/modules/alert.sh
  3. 123
      lgsm/modules/alert_discord.sh
  4. 142
      lgsm/modules/alert_rocketchat.sh
  5. 228
      lgsm/modules/alert_slack.sh
  6. 4
      lgsm/modules/check_deps.sh
  7. 8
      lgsm/modules/command_update_linuxgsm.sh

2
.github/workflows/details-check-generate-matrix.sh

@ -1,6 +1,6 @@
#!/bin/bash
curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/${datadir}/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
echo -n "{" > "shortnamearray.json"
echo -n "\"include\":[" >> "shortnamearray.json"

2
lgsm/modules/alert.sh

@ -198,7 +198,7 @@ fn_alert_info() {
}
# Images
alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${datadir}/gameicons/${shortname}-icon.png"
alerticon="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/gameicons/${shortname}-icon.png"
if [ "${alert}" == "permissions" ]; then
fn_alert_permissions

123
lgsm/modules/alert_discord.sh

@ -10,25 +10,25 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(
cat << EOF
{
"username": "LinuxGSM",
"avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"file": "content",
"embeds": [
{
"author": {
"name": "LinuxGSM Alert",
"url": "",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
},
"title": "${alerttitle}",
"url": "",
"description": "",
"color": "${alertcolourdec}",
"type": "content",
"thumbnail": {
"url": "${alerticon}"
},
"fields": [
"username": "LinuxGSM",
"avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"file": "content",
"embeds": [
{
"author": {
"name": "LinuxGSM Alert",
"url": "",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
},
"title": "${alerttitle}",
"url": "",
"description": "",
"color": "${alertcolourdec}",
"type": "content",
"thumbnail": {
"url": "${alerticon}"
},
"fields": [
{
"name": "Server Name",
"value": "${servername}"
@ -42,22 +42,44 @@ json=$(
"value": "${gamename}",
"inline": true
},
{
"name": "Server IP",
"value": "\`${alertip}:${port}\`",
"inline": true
},
{
"name": "Hostname",
"value": "${HOSTNAME}",
"inline": true
},
{
"name": "Server Time",
"value": "$(date)",
"inline": true
}
],
"footer": {
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}"
}
}
]
}
EOF
)
if [ -n "${querytype}" ]; then
json+=$(
cat << EOF
jsonnoinfo=$(
cat << EOF
{
"username": "LinuxGSM",
"avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"file": "content",
"embeds": [
{
"author": {
"name": "LinuxGSM Alert",
"url": "",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
},
"title": "${alerttitle}",
"url": "",
"description": "",
"color": "${alertcolourdec}",
"type": "content",
"thumbnail": {
"url": "${alerticon}"
},
"fields": [
{
"name": "Is my Game Server Online?",
"value": "https://ismygameserver.online/${querytype}/${alertip}:${queryport}",
@ -74,18 +96,33 @@ json+=$(
"value": "${alerturl}",
"inline": true
},
{
"name": "Server Time",
"value": "$(date)",
"inline": true
}
],
"footer": {
{
"name": "Game",
"value": "${gamename}",
"inline": true
},
{
"name": "Server IP",
"value": "\`${alertip}:${port}\`",
"inline": true
},
{
"name": "Hostname",
"value": "${HOSTNAME}",
"inline": true
},
{
"name": "Server Time",
"value": "$(date)",
"inline": true
}
],
"footer": {
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}"
}
}
]
"text": "Sent by LinuxGSM ${version}"
}
}
]
}
EOF
)

142
lgsm/modules/alert_rocketchat.sh

@ -10,43 +10,57 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(
cat << EOF
{
"alias": "LinuxGSM",
"text": "*${alerttitle}*",
"attachments": [
{
"title": "",
"color": "${alertcolourhex}",
"author_name": "LinuxGSM Alert",
"author_link": "https://linuxgsm.com",
"author_icon": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"thumb_url": "${alerticon}",
"text": "",
"fields": [
{
"short": false,
"title": "Server Name",
"value": "${servername}"
},
{
"short": false,
"title": "Information",
"value": "${alertmessage}"
},
{
"short": false,
"title": "Game",
"value": "${gamename}"
},
{
"short": false,
"title": "Server IP",
"value": "${alertip}:${port}"
},
{
"short": false,
"title": "Hostname",
"value": "${HOSTNAME}"
},
"alias": "LinuxGSM",
"text": "*${alerttitle}*",
"attachments": [
{
"title": "",
"color": "${alertcolourhex}",
"author_name": "LinuxGSM Alert",
"author_link": "https://linuxgsm.com",
"author_icon": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"thumb_url": "${alerticon}",
"text": "",
"fields": [
{
"short": false,
"title": "Server Name",
"value": "${servername}"
},
{
"short": false,
"title": "Information",
"value": "${alertmessage}"
},
{
"short": false,
"title": "Game",
"value": "${gamename}"
},
{
"short": false,
"title": "Server IP",
"value": "${alertip}:${port}"
},
{
"short": false,
"title": "Hostname",
"value": "${HOSTNAME}"
},
{
"short": false,
"title": "More info",
"value": "${alerturl}"
},
{
"short": false,
"title": "Server Time",
"value": "$(date)"
}
]
}
]
}
EOF
)
@ -76,14 +90,52 @@ fi
json+=$(
cat << EOF
{
"short": false,
"title": "Server Time",
"value": "$(date)"
}
]
}
]
{
"alias": "LinuxGSM",
"text": "*${alerttitle}*",
"attachments": [
{
"title": "",
"color": "${alertcolourhex}",
"author_name": "LinuxGSM Alert",
"author_link": "https://linuxgsm.com",
"author_icon": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"thumb_url": "${alerticon}",
"text": "",
"fields": [
{
"short": false,
"title": "Server Name",
"value": "${servername}"
},
{
"short": false,
"title": "Information",
"value": "${alertmessage}"
},
{
"short": false,
"title": "Game",
"value": "${gamename}"
},
{
"short": false,
"title": "Server IP",
"value": "${alertip}:${port}"
},
{
"short": false,
"title": "Hostname",
"value": "${HOSTNAME}"
},
{
"short": false,
"title": "Server Time",
"value": "$(date)"
}
]
}
]
}
EOF
)

228
lgsm/modules/alert_slack.sh

@ -10,61 +10,80 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(
cat << EOF
{
"attachments": [
{
"color": "${alertcolourhex}",
"blocks": [
{
"type": "header",
"text": {
"type": "mrkdwn",
"text": "${alerttitle}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Name*\n${servername}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Information*\n${alertmessage}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Game*\n${gamename}"
},
{
"type": "mrkdwn",
"text": "*Server IP*\n\`${alertip}:${port}\`"
},
{
"type": "mrkdwn",
"text": "*Hostname*\n${HOSTNAME}"
},
{
"type": "mrkdwn",
"text": "*Server Time*\n$(date)"
}
],
"accessory": {
"type": "image",
"image_url": "${alerticon}",
"alt_text": "cute cat"
}
},
"attachments": [
{
"color": "${alertcolourhex}",
"blocks": [
{
"type": "header",
"text": {
"type": "mrkdwn",
"text": "${alerttitle}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Name*\n${servername}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Information*\n${alertmessage}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Game*\n${gamename}"
},
{
"type": "mrkdwn",
"text": "*Server IP*\n\`${alertip}:${port}\`"
},
{
"type": "mrkdwn",
"text": "*Hostname*\n${HOSTNAME}"
},
{
"type": "mrkdwn",
"text": "*Server Time*\n$(date)"
}
],
"accessory": {
"type": "image",
"image_url": "${alerticon}",
"alt_text": "cute cat"
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"alt_text": "LinuxGSM icon"
},
{
"type": "plain_text",
"text": "Sent by LinuxGSM ${version}",
"emoji": true
}
]
}
]
}
]
}
EOF
)
@ -98,24 +117,87 @@ fi
json+=$(
cat << EOF
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"alt_text": "LinuxGSM icon"
},
{
"type": "plain_text",
"text": "Sent by LinuxGSM ${version}",
"emoji": true
}
]
}
]
}
]
{
"attachments": [
{
"color": "${alertcolourhex}",
"blocks": [
{
"type": "header",
"text": {
"type": "mrkdwn",
"text": "${alerttitle}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Name*\n${servername}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Information*\n${alertmessage}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Game*\n${gamename}"
},
{
"type": "mrkdwn",
"text": "*Server IP*\n\`${alertip}:${port}\`"
},
{
"type": "mrkdwn",
"text": "*Hostname*\n${HOSTNAME}"
},
{
"type": "mrkdwn",
"text": "*Server Time*\n$(date)"
}
],
"accessory": {
"type": "image",
"image_url": "${alerticon}",
"alt_text": "cute cat"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Server Time*\n${alertmessage}"
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"alt_text": "LinuxGSM icon"
},
{
"type": "plain_text",
"text": "Sent by LinuxGSM ${version}",
"emoji": true
}
]
}
]
}
]
}
EOF
)

4
lgsm/modules/check_deps.sh

@ -358,9 +358,9 @@ info_distro.sh
if [ ! -f "${tmpdir}/dependency-no-check.tmp" ] && [ ! -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
# Check that the distro dependency csv file exists.
fn_check_file_github "${datadir}" "${distroid}-${distroversioncsv}.csv"
fn_check_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv"
if [ -n "${checkflag}" ] && [ "${checkflag}" == "0" ]; then
fn_fetch_file_github "${datadir}" "${distroid}-${distroversioncsv}.csv" "${datadir}" "chmodx" "norun" "noforce" "nohash"
fn_fetch_file_github "lgsm/data" "${distroid}-${distroversioncsv}.csv" "${datadir}" "chmodx" "norun" "noforce" "nohash"
fi
fi

8
lgsm/modules/command_update_linuxgsm.sh

@ -160,9 +160,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c"
fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
if [ "${remotereponame}" == "GitHub" ]; then
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${datadir}/${distroid}-${distroversioncsv}.csv" 1> /dev/null
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
else
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${datadir}/${distroid}-${distroversioncsv}.csv" 1> /dev/null
curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
fi
if [ $? != "0" ]; then
fn_print_fail_eol_nl
@ -172,9 +172,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
fi
if [ "${remotereponame}" == "GitHub" ]; then
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${datadir}/${distroid}-${distroversioncsv}.csv"))
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
else
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${datadir}/${distroid}-${distroversioncsv}.csv"))
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
fi
if [ "${config_file_diff}" != "" ]; then

Loading…
Cancel
Save