From 6a6f6c493c0362aa667564eda7b9e01f5b8a56b5 Mon Sep 17 00:00:00 2001 From: "Yenthe V.G" Date: Tue, 3 Oct 2017 12:00:40 +0200 Subject: [PATCH] FIX: Create configuration file from scratch We've used to copy the .conf file from /debian/odoo.conf and modified it along the way to our needs. This could trigger issues and cornercases. Since Odoo 11.0 this breaks the default installation script. There where two options: 1) Create sed commands to find the doubles and remove them - which would have issues with the regex expressions and special characters such as "/". 2) Create a new configuration file from scratch and fill it with our own data Obviously, I went for option 2. --- odoo_install.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/odoo_install.sh b/odoo_install.sh index be210a5..710061e 100644 --- a/odoo_install.sh +++ b/odoo_install.sh @@ -13,7 +13,7 @@ # Execute the script to install Odoo: # ./odoo-install ################################################################################ - + ##fixed parameters #odoo OE_USER="odoo" @@ -147,19 +147,20 @@ echo -e "\n---- Setting permissions on home folder ----" sudo chown -R $OE_USER:$OE_USER $OE_HOME/* echo -e "* Create server config file" -sudo cp $OE_HOME_EXT/debian/odoo.conf /etc/${OE_CONFIG}.conf -sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf -sudo chmod 640 /etc/${OE_CONFIG}.conf -echo -e "* Change server config file" -sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/${OE_CONFIG}.conf -sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/${OE_CONFIG}.conf -sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf" -if [ $IS_ENTERPRISE = "True" ]; then - sudo su root -c "echo 'addons_path=$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons' >> /etc/${OE_CONFIG}.conf" +sudo touch /etc/${OE_CONFIG}.conf +echo -e "* Creating server config file" +sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/${OE_CONFIG}.conf" +sudo su root -c "printf 'admin_passwd = ${OE_SUPERADMIN}\n' >> /etc/${OE_CONFIG}.conf" +sudo su root -c "printf 'xmlrpc_port = ${OE_PORT}\n' >> /etc/${OE_CONFIG}.conf" +sudo su root -c "printf 'logfile = /var/log/${OE_USER}/${OE_CONFIG}\n' >> /etc/${OE_CONFIG}.conf" +if [ $IS_ENTERPRISE = "True" ]; then + sudo su root -c "printf 'addons_path=${OE_HOME}/enterprise/addons,${OE_HOME_EXT}/addons\n' >> /etc/${OE_CONFIG}.conf" else - sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf" + sudo su root -c "printf 'addons_path=${OE_HOME_EXT}/addons,${OE_HOME}/custom/addons\n' >> /etc/${OE_CONFIG}.conf" fi +sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf +sudo chmod 640 /etc/${OE_CONFIG}.conf echo -e "* Create startup file" sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh" @@ -242,9 +243,6 @@ sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG sudo chmod 755 /etc/init.d/$OE_CONFIG sudo chown root: /etc/init.d/$OE_CONFIG -echo -e "* Change default xmlrpc port" -sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf" - echo -e "* Start ODOO on Startup" sudo update-rc.d $OE_CONFIG defaults