diff --git a/scripts/_common.sh b/scripts/_common.sh index b579b44..b0b88b7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -23,6 +23,7 @@ function define_paths() { } function check_odoo_version () { + command -v bc >/dev/null 2>&1 || ynh_package_install bc if [ $(echo "$odoo_version >= 10" | bc) -ne 0 ]; then if [ -f /usr/bin/openerp-server ]; then ynh_die "Another version of odoo is installed" @@ -75,7 +76,9 @@ function install_dependencies() { if [ ! -f /etc/apt/sources.list.d/odoo.list ]; then # Install Odoo # Prepare installation - ynh_package_install curl bc + # We nee to setup postgresql before to let the odoo package make some magic + # see red comment on https://nightly.odoo.com/ + ynh_package_install curl bc postgresql # Install Odoo curl -sS https://nightly.odoo.com/odoo.key | sudo apt-key add - diff --git a/scripts/backup b/scripts/backup index c727458..f8da399 100644 --- a/scripts/backup +++ b/scripts/backup @@ -25,8 +25,11 @@ ynh_backup "$conf_file" "$1$conf_file" ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "etc/nginx/conf.d/${domain}.d/${app}.conf" # Save postgresql conf -ynh_backup "/etc/postgresql/9.4/main/pg_hba.conf" "etc/postgresql/9.4/main/pg_hba.conf" - +if is_jessie ; then + ynh_backup "/etc/postgresql/9.4/main/pg_hba.conf" "etc/postgresql/9.4/main/pg_hba.conf" +else + ynh_backup "/etc/postgresql/9.6/main/pg_hba.conf" "etc/postgresql/9.6/main/pg_hba.conf" +fi # Copy database database=${domain//./-} sudo su -c "pg_dump $database" postgres > ./dump.sql diff --git a/scripts/install b/scripts/install index 7e68529..6996003 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ function setup_files() { # Fix peer authentification issue sed -i '/local\s*all\s*all\s*peer/i \ - local all odoo password' /etc/postgresql/9.4/main/pg_hba.conf + local all odoo password' /etc/postgresql/9.*/main/pg_hba.conf ynh_configure_nginx } diff --git a/scripts/restore b/scripts/restore index 0d3b76f..f6c0b5c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,7 @@ function restore_files () { if [ "$is_master" = true ]; then ynh_restore chown -R odoo:odoo /var/lib/odoo/ - chown postgres:postgres /etc/postgresql/9.4/main/pg_hba.conf + chown postgres:postgres /etc/postgresql/9.*/main/pg_hba.conf else # If odoo is already setup we just restore nginx and add some missing # modules. Other files are already on system, and we don't want to