2015-09-14 17:12:17 +02:00
|
|
|
#!/bin/bash
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-07-05 15:22:12 +02:00
|
|
|
|
|
|
|
# Source YunoHost helpers
|
2017-05-18 23:28:18 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source _future.sh
|
|
|
|
source _common.sh
|
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2016-07-05 15:22:12 +02:00
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-05-18 23:28:18 +02:00
|
|
|
export app=$YNH_APP_INSTANCE_NAME
|
|
|
|
export domain=$(ynh_app_setting_get "$app" domain)
|
2018-12-14 19:24:55 +01:00
|
|
|
export app_version=$(ynh_app_setting_get "$app" app_version)
|
2017-05-18 23:28:18 +02:00
|
|
|
export is_master=$(ynh_app_setting_get "$app" is_master)
|
|
|
|
export oca=$(ynh_app_setting_get "$app" oca)
|
|
|
|
export port=$(ynh_app_setting_get $app port)
|
|
|
|
export is_public=0
|
2018-05-21 15:44:09 +02:00
|
|
|
export major_upgrade=$(ynh_app_setting_get $app major_upgrade)
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
#=================================================
|
|
|
|
# CHECK VERSION
|
|
|
|
#=================================================
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
ynh_abort_if_up_to_date
|
2015-09-14 17:12:17 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
#=================================================
|
|
|
|
# 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
|
|
|
|
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
#=================================================
|
|
|
|
# STEP Migrations
|
|
|
|
#=================================================
|
2017-05-18 23:28:18 +02:00
|
|
|
# Zamentur version https://github.com/zamentur/odoo_ynh/commit/cdeb9afbf218431781f752dedfbf4247afbd5b44
|
2018-05-21 15:44:09 +02:00
|
|
|
if ynh_version_le "9.0-0" ; then
|
2017-05-18 23:28:18 +02:00
|
|
|
# set new args
|
2018-12-14 19:24:55 +01:00
|
|
|
app_version=${app_version:-$(ynh_app_setting_get "$app" version)}
|
2017-05-18 23:28:18 +02:00
|
|
|
port=${port:-8069}
|
|
|
|
oca=${oca:-false}
|
2018-12-14 19:24:55 +01:00
|
|
|
ynh_save_args app_version oca is_master port
|
2017-05-18 23:28:18 +02:00
|
|
|
|
|
|
|
# Install official debian package
|
|
|
|
install_dependencies
|
|
|
|
fi
|
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
if ynh_version_le "11.0-1" ; then
|
|
|
|
# By default we don't upgrade to major version
|
|
|
|
major_upgrade=${major_upgrade:-0}
|
|
|
|
ynh_save_args major_upgrade
|
2017-05-18 23:28:18 +02:00
|
|
|
fi
|
|
|
|
|
2018-12-14 03:36:58 +01:00
|
|
|
ynh_system_user_create $app
|
2018-12-14 19:49:43 +01:00
|
|
|
setup_files
|
2018-12-14 03:36:58 +01:00
|
|
|
install_dependencies
|
|
|
|
service $app restart
|