1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00
libreerp_ynh/scripts/upgrade
2018-05-21 15:44:09 +02:00

87 lines
2.5 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 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
export major_upgrade=$(ynh_app_setting_get $app major_upgrade)
#=================================================
# CHECK VERSION
#=================================================
ynh_abort_if_up_to_date
#=================================================
# 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 ynh_version_le "9.0-0" ; then
# 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
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