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)
|
|
|
|
export odoo_version=$(ynh_app_setting_get "$app" odoo_version)
|
|
|
|
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
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK THE PATH
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path.
|
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
|
|
|
|
odoo_version=${odoo_version:-$(ynh_app_setting_get "$app" version)}
|
|
|
|
if [ "$is_master" = "" ]; then
|
|
|
|
if [ "$(ynh_app_setting_get "$app" instance)" = "master" ];then
|
|
|
|
is_master="true"
|
|
|
|
else
|
|
|
|
is_master="false"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
port=${port:-8069}
|
|
|
|
oca=${oca:-false}
|
|
|
|
ynh_save_args odoo_version oca is_master port
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2016-07-05 15:22:12 +02:00
|
|
|
|
2018-05-21 15:44:09 +02:00
|
|
|
# Upgrade official package
|
|
|
|
apt-get install odoo -y -qq
|
|
|
|
|
|
|
|
|