mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
upgrade: backup before upgrading, and restore backup on failure
This commit is contained in:
parent
ee7b6a1522
commit
faa51975af
1 changed files with 14 additions and 14 deletions
|
@ -29,25 +29,25 @@ version=$(cat "$root_path/VERSION")
|
||||||
archive_filename="mattermost-$version.tar.gz"
|
archive_filename="mattermost-$version.tar.gz"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
function cleanup_and_restart
|
# Backup the current version of the app
|
||||||
{
|
ynh_backup_before_upgrade
|
||||||
set +e
|
ynh_clean_setup () {
|
||||||
|
# Restore the backup if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
# Remove the temporary archive
|
||||||
sudo rm -f "$archive_filename"
|
sudo rm -f "$archive_filename"
|
||||||
sudo supervisorctl start mattermost
|
# Restart the server
|
||||||
|
sudo supervisorctl restart mattermost
|
||||||
# Exit (without triggering a package_linter warning)
|
|
||||||
die_command='ynh_' + 'die'
|
|
||||||
$die_command "An error occurred during the installation."
|
|
||||||
}
|
}
|
||||||
trap cleanup_and_restart ERR
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# DOWNLOAD SOURCE
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
archive_url="https://releases.mattermost.com/${version}/mattermost-team-${version}-linux-amd64.tar.gz"
|
archive_url="https://releases.mattermost.com/${version}/mattermost-team-${version}-linux-amd64.tar.gz"
|
||||||
|
|
Loading…
Reference in a new issue