libreerp_ynh/scripts/upgrade
2019-09-19 10:28:09 +02:00

58 lines
1.7 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)
export preinstall=0
#=================================================
# 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