From 94b2b28db1286ef79c3d3ba41d047daa6eaf3e01 Mon Sep 17 00:00:00 2001 From: ljf Date: Mon, 21 May 2018 15:44:09 +0200 Subject: [PATCH] [fix] Export bin_file --- conf/openupgrade.src | 5 ++++ scripts/_common.sh | 4 ++-- scripts/upgrade | 57 ++++++++++++++++++++++++++++++++++---------- 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 conf/openupgrade.src diff --git a/conf/openupgrade.src b/conf/openupgrade.src new file mode 100644 index 0000000..7bba77f --- /dev/null +++ b/conf/openupgrade.src @@ -0,0 +1,5 @@ +SOURCE_URL=https://raw.githubusercontent.com/OCA/OpenUpgrade/11.0/scripts/migrate.py +SOURCE_SUM=362c8cf9b43a3aaddb440e642205e9596da78e28d1e47b582612ced671d95e0b +SOURCE_FILE=odoo-migrate-11.py +SOURCE_SUM_PRG=sha256sum +SOURCE_EXTRACT=False diff --git a/scripts/_common.sh b/scripts/_common.sh index cdc3320..f24ac78 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -13,11 +13,11 @@ function define_paths() { export source_path=/usr/lib/python2.7/dist-packages/odoo/ fi export conf_file=/etc/odoo/odoo.conf - bin_file=/usr/bin/odoo + export bin_file=/usr/bin/odoo else export source_path=/usr/lib/python2.7/dist-packages/openerp/ export conf_file=/etc/odoo/openerp-server.conf - bin_file=/usr/bin/openerp-server + export bin_file=/usr/bin/openerp-server fi } diff --git a/scripts/upgrade b/scripts/upgrade index 51aed46..b0948a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,13 +1,19 @@ #!/bin/bash -set -eu +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= # Source YunoHost helpers source /usr/share/yunohost/helpers source _future.sh source _common.sh -ynh_trap_on +#================================================= +# LOAD SETTINGS +#================================================= # Retrieve arguments export app=$YNH_APP_INSTANCE_NAME @@ -17,18 +23,40 @@ 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 +export major_upgrade=$(ynh_app_setting_get $app major_upgrade) -version=$(ynh_read_json "/etc/yunohost/apps/$app/manifest.json" 'version' 2> /dev/null || echo '9.0-0') -last_version=$(ynh_read_manifest 'version') +#================================================= +# CHECK VERSION +#================================================= -#ynh_exit_if_up_to_date -ynh_check_var "$app" "app name not set" +ynh_abort_if_up_to_date -# Upgrade official package -apt-get install odoo -y -qq +#================================================= +# 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. + +#================================================= +# STEP Migrations +#================================================= # Zamentur version https://github.com/zamentur/odoo_ynh/commit/cdeb9afbf218431781f752dedfbf4247afbd5b44 -if [ "${version}" = "9.0-0" ]; then +if ynh_version_le "9.0-0" ; then # set new args odoo_version=${odoo_version:-$(ynh_app_setting_get "$app" version)} if [ "$is_master" = "" ]; then @@ -46,9 +74,14 @@ if [ "${version}" = "9.0-0" ]; then install_dependencies fi -if [ "${version}" = "10.0-1" ]; then - # Put here your migrations - echo "" +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 fi +# Upgrade official package +apt-get install odoo -y -qq + +