mirror of
https://github.com/YunoHost-Apps/libreerp_ynh.git
synced 2024-09-03 19:36:13 +02:00
82 lines
2.4 KiB
Bash
82 lines
2.4 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
|
|
|
|
|
|
#=================================================
|
|
# 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)}
|
|
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
|
|
|
|
ynh_system_user_create $app
|
|
ynh_setup_source "$final_path/$APPNAME" $odoo_version
|
|
mkdir -p $final_path/custom-addons
|
|
chown -R $app:$app $final_path
|
|
ynh_configure server.conf $conf_file
|
|
chown $app:$app $conf_file
|
|
|
|
touch /var/log/$app.log
|
|
chown $app:$app /var/log/$app.log
|
|
|
|
install_dependencies
|
|
service $app restart
|