[fix] Postgresql 9.4 or 9.6

This commit is contained in:
ljf 2018-09-19 15:53:06 +02:00
parent ee01a74569
commit 3572359811
4 changed files with 11 additions and 5 deletions

View file

@ -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 -

View file

@ -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

View file

@ -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
}

View file

@ -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