diff --git a/conf/server.conf.j2 b/conf/server.conf.j2 index 996d0f4..432078a 100644 --- a/conf/server.conf.j2 +++ b/conf/server.conf.j2 @@ -5,10 +5,14 @@ admin_passwd = {{ admin_password }} db_host = localhost db_port = 5432 db_user = {{ db_name }} -db_name = {{ db_name }} db_password = {{ db_pass }} -dbfilter = False +{% if preinstall == '1' %} +dbfilter = ^{{ db_name }}$ +{% else %} +db_name = {{ db_name }} +{% if app_version > 9 %}dbfilter = False{% endif %} list_db = False +{% endif %} addons_path = {{ final_path }}/{{ APPNAME }}/addons,{{ final_path }}/custom-addons proxy_mode = true logfile = /var/log/{{ app }}.log diff --git a/scripts/install b/scripts/install index 4b9f3f6..82e8434 100644 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,7 @@ fi export db_name=$(ynh_sanitize_dbid $app) export port=$(ynh_find_port 8069) export port_chat=$(ynh_find_port 8072) +export preinstall=0 #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS @@ -38,17 +39,27 @@ ynh_webpath_register $app $domain "/" #================================================= function setup_database() { - + export preinstall=1 + ynh_configure server.conf $conf_file + chown $app:$app $conf_file # Load translation + #param=" --without-demo True --addons-path $final_path/$APPNAME/addons --db_user $app --db_password $db_pass --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app " + param=" -c $conf_file -d $app " sudo -u $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app - sudo -u $app $bin_file -c $conf_file --stop-after-init -d $app --load-language $lang + sudo -u $app $bin_file -c $conf_file --stop-after-init --load-language $lang -d $app # Configure language, timezone and ldap sudo -u $app $bin_file shell -c $conf_file -d $app <<< \ " self.env['res.users'].search([['login', '=', 'admin']])[0].write({'password': '$admin_password'}) self.env.cr.commit() +" + sudo -u $app $bin_file shell -c $conf_file -d $app <<< \ +" self.write({'tz':'$tz','lang':'$lang'}) self.env.cr.commit() +" + sudo -u $app $bin_file shell -c $conf_file -d $app <<< \ +" template=env['res.users'].create({ 'login':'template', 'password':'', @@ -69,6 +80,9 @@ self.company_id.ldaps.create({ }) self.env.cr.commit() " + export preinstall=0 + ynh_configure server.conf $conf_file + chown $app:$app $conf_file } ynh_save_args domain app_version oca lang tz final_path conf_file db_name port port_chat ynh_system_user_create -u $app -h $final_path diff --git a/scripts/upgrade b/scripts/upgrade index 1008026..f6bc1d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ export port_chat=$(ynh_app_setting_get $app port_chat) export is_public=0 export final_path=$(ynh_app_setting_get $app final_path) export conf_file=$(ynh_app_setting_get $app conf_file) +export preinstall=0 #================================================= # CHECK VERSION