libreerp_ynh/scripts/upgrade
2018-12-16 19:41:40 +01:00

57 lines
1.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers
source /usr/share/yunohost/helpers
source _future.sh
source _common.sh
#=================================================
# LOAD SETTINGS
#=================================================
# Retrieve arguments
export app=$YNH_APP_INSTANCE_NAME
export domain=$(ynh_app_setting_get "$app" domain)
export app_version=$(ynh_app_setting_get "$app" app_version)
export oca=$(ynh_app_setting_get "$app" oca)
export port=$(ynh_app_setting_get $app port)
export port_chat=$(ynh_app_setting_get $app port_chat)
export is_public=0
export final_path=$(ynh_app_setting_get $app final_path)
export conf_file=$(ynh_app_setting_get $app conf_file)
#=================================================
# CHECK VERSION
#=================================================
ynh_check_app_version_changed
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STEP Migrations
#=================================================
ynh_system_user_create $app
setup_files
install_dependencies
service $app restart