Created
August 28, 2019 13:38
-
-
Save elpatron68/13b0ed3d9417b437ac7a38ef26516f1a to your computer and use it in GitHub Desktop.
Mattermost update script
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 characters
| #!/bin/sh | |
| # export URL before launch: eg. `export URL=https://releases.mattermost.com/5.14.0/mattermost-5.14.0-linux-amd64.tar.gz` | |
| # The script assumes, that Mattermost is installed in ~/mattermost | |
| cd /tmp | |
| wget $URL | |
| tar -xf mattermost*.gz --transform='s,^[^/]\+,\0-upgrade,' | |
| sudo systemctl stop mattermost | |
| cd ~/ | |
| cp -ra mattermost/ mattermost-back-$(date +'%F-%H-%M')/ | |
| find mattermost/ mattermost/client/ -mindepth 1 -maxdepth 1 \! \( -type d \( -path mattermost/client -o -path mattermost/client/plugins -o -path mattermost/config -o -path mattermost/logs -o -path mattermost/plugins -o -path mattermost/data \) -prune \) | sort | sudo xargs rm -r | |
| mv mattermost/plugins/ mattermost/plugins~ | |
| mv mattermost/client/plugins/ mattermost/client/plugins~ | |
| cp -an /tmp/mattermost-upgrade/. mattermost/ | |
| rm -r /tmp/mattermost-upgrade/ | |
| cd ~/mattermost | |
| sudo systemctl start mattermost | |
| rsync -au plugins~/ plugins | |
| rm -rf plugins~ | |
| rsync -au client/plugins~/ client/plugins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment