Last active
October 22, 2025 05:39
-
-
Save Roy-Orbison/e7a24ad07475d8af140b6f8900efbb62 to your computer and use it in GitHub Desktop.
Revisions
-
Roy-Orbison revised this gist
Oct 22, 2025 . No changes.There are no files selected for viewing
-
Roy-Orbison revised this gist
Oct 22, 2025 . 1 changed file with 15 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,16 +11,21 @@ if [ "${MM_TEAM_ED:-0}" -gt 0 ]; then else ed=Enterprise fi if [ "${MM_ESR:-0}" -gt 0 ]; then esr=1 else esr=0 fi index=https://raw.githubusercontent.com/mattermost/docs/refs/heads/master/source/product-overview/version-archive.rst index=$(curl --no-progress-meter "$index") [ "$index" ] latest=$( awk -v ed=$ed -v esr=$esr "$(cat <<-'EOAWK' BEGIN { preamble = 1 RS = "\n +Mattermost " ed " Edition v" FS = "\n +-" } preamble { preamble=0 @@ -29,7 +34,7 @@ latest_checksum=$( { if (esr && !match($1, /\(ESR\)/)) next v = gensub(/[[:space:]].*/, "", 1, $1) if (!match($3, "SHA-256")) { print "no checksum found" exit 1 @@ -39,12 +44,13 @@ latest_checksum=$( printf "%s\t%s\t%s\n", v, u, c exit } EOAWK )" <<-EORST $index EORST ) read -r version_latest archive checksum <<-EOT $latest EOT if [ "$version_current" != "$version_latest" ]; then -
Roy-Orbison revised this gist
Aug 28, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ else ed=Enterprise fi index=https://raw.githubusercontent.com/mattermost/docs/refs/heads/master/source/product-overview/version-archive.rst index=$(curl --no-progress-meter "$index") [ "$index" ] latest_checksum=$( -
Roy-Orbison renamed this gist
Aug 15, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Roy-Orbison revised this gist
Aug 15, 2025 . 1 changed file with 47 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,57 @@ #!/bin/sh set -e version_current=$( sudo -u "${MM_USER:-mattermost}" "${MM_BIN:-/opt/mattermost/bin/mattermost}" version | \ grep -Pio '^version:\s*\K\S+' ) if [ "${MM_TEAM_ED:-0}" -gt 0 ]; then ed=Team else ed=Enterprise fi index=https://github.com/mattermost/docs/raw/refs/heads/master/source/product-overview/version-archive.rst index=$(curl --no-progress-meter "$index") [ "$index" ] latest_checksum=$( awk -v ed=$ed -v esr="${MM_ESR:-0}" ' BEGIN { preamble = 1 RS = "$|Mattermost " ed " Edition v" FS = "\n" } preamble { preamble=0 next } { if (esr && !match($1, /\(ESR\)/)) next v = gensub(/[[:space:]].*/, "", "g", $1) if (!match($3, "SHA-256")) { print "no checksum found" exit 1 } u = gensub(/^[^`]*`+|`.*/, "", "g", $2) c = gensub(/^[^`]*`+|`.*/, "", "g", $3) printf "%s\t%s\t%s\n", v, u, c exit } ' <<-EOT $index EOT ) read -r version_latest archive checksum <<-EOT $latest_checksum EOT if [ "$version_current" != "$version_latest" ]; then curl -sS --json @- "$MM_HOOK" <<-EOJSON > /dev/null { "channel": "$MM_CHANNEL", "text": ":information_source: Mattermost upgrade available: [v$version_latest]($archive)\\nChecksum: \`$checksum\`\\n" } EOJSON fi -
Roy-Orbison created this gist
Nov 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/sh mm_hook=https://you-mm-server.example/hooks/abcdefghijklmnopqrstuvwxyz mm_channel=@your_username read -r latest checksum <<-EOSH $(curl --no-progress-meter https://docs.mattermost.com/about/version-archive.html | \ tr '\r\n' ' ' | \ perl -ne 'print "$1\t$2\n" if m/<dt\b[^<]+?\bTeam\b[^<]+<[^<]+?\bESR\b(?:(?!<dt\b).)+?>\K(https:\/\/releases.mattermost.com\/[^\s<]+).*?\b([[:xdigit:]]{64})\b/' ) EOSH if ! [ "$latest" ]; then echo Could not determine latest version >&2 exit 1 fi version_current=$(sudo -u mattermost /opt/mattermost/bin/mattermost version | grep -Pio '^version:\s*\K\S+') version_latest=$(printf '%s\n' "$latest" | grep -Po '/\K\d+\.\d+\.\d+(?=/)') if [ "$version_current" != "$version_latest" ]; then curl -sS --json @- "$mm_hook" <<-EOJSON > /dev/null { "channel": "$mm_channel", "text": ":information_source: Mattermost upgrade available: [v$version_latest]($latest)\\nChecksum: \`$checksum\`\\n" } EOJSON fi