Browse Source
Merge branch 'develop' into feature/ismgs
pull/4741/head
Daniel Gibbs
8 months ago
No known key found for this signature in database
GPG Key ID: 2076B128385E8C55
7 changed files with
340 additions and
169 deletions
-
.github/workflows/details-check-generate-matrix.sh
-
lgsm/modules/alert.sh
-
lgsm/modules/alert_discord.sh
-
lgsm/modules/alert_rocketchat.sh
-
lgsm/modules/alert_slack.sh
-
lgsm/modules/check_deps.sh
-
lgsm/modules/command_update_linuxgsm.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" |
|
|
|
|
|
@ -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 |
|
|
|
|
|
@ -43,21 +43,43 @@ json=$( |
|
|
|
"inline": true |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "Server IP", |
|
|
|
"value": "\`${alertip}:${port}\`", |
|
|
|
"inline": true |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "Hostname", |
|
|
|
"value": "${HOSTNAME}", |
|
|
|
"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+=$( |
|
|
|
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,6 +96,21 @@ json+=$( |
|
|
|
"value": "${alerturl}", |
|
|
|
"inline": true |
|
|
|
}, |
|
|
|
{ |
|
|
|
"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)", |
|
|
|
|
|
@ -47,6 +47,20 @@ json=$( |
|
|
|
"title": "Hostname", |
|
|
|
"value": "${HOSTNAME}" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"short": false, |
|
|
|
"title": "More info", |
|
|
|
"value": "${alerturl}" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"short": false, |
|
|
|
"title": "Server Time", |
|
|
|
"value": "$(date)" |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
EOF |
|
|
|
) |
|
|
|
|
|
|
@ -76,6 +90,44 @@ fi |
|
|
|
|
|
|
|
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}" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"short": false, |
|
|
|
"title": "Server Time", |
|
|
|
|
|
@ -65,6 +65,25 @@ json=$( |
|
|
|
"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,6 +117,69 @@ fi |
|
|
|
|
|
|
|
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" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"type": "section", |
|
|
|
"text": { |
|
|
|
"type": "mrkdwn", |
|
|
|
"text": "*Server Time*\n${alertmessage}" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"type": "context", |
|
|
|
"elements": [ |
|
|
|
|
|
@ -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 |
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
|