Skip to content

Commit 6a6f6c4

Browse files
authored
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.
1 parent c7da009 commit 6a6f6c4

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

odoo_install.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Execute the script to install Odoo:
1414
# ./odoo-install
1515
################################################################################
16-
16+
1717
##fixed parameters
1818
#odoo
1919
OE_USER="odoo"
@@ -147,19 +147,20 @@ echo -e "\n---- Setting permissions on home folder ----"
147147
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
148148

149149
echo -e "* Create server config file"
150-
sudo cp $OE_HOME_EXT/debian/odoo.conf /etc/${OE_CONFIG}.conf
151-
sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf
152-
sudo chmod 640 /etc/${OE_CONFIG}.conf
153150

154-
echo -e "* Change server config file"
155-
sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/${OE_CONFIG}.conf
156-
sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/${OE_CONFIG}.conf
157-
sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/${OE_CONFIG}.conf"
158-
if [ $IS_ENTERPRISE = "True" ]; then
159-
sudo su root -c "echo 'addons_path=$OE_HOME/enterprise/addons,$OE_HOME_EXT/addons' >> /etc/${OE_CONFIG}.conf"
151+
sudo touch /etc/${OE_CONFIG}.conf
152+
echo -e "* Creating server config file"
153+
sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/${OE_CONFIG}.conf"
154+
sudo su root -c "printf 'admin_passwd = ${OE_SUPERADMIN}\n' >> /etc/${OE_CONFIG}.conf"
155+
sudo su root -c "printf 'xmlrpc_port = ${OE_PORT}\n' >> /etc/${OE_CONFIG}.conf"
156+
sudo su root -c "printf 'logfile = /var/log/${OE_USER}/${OE_CONFIG}\n' >> /etc/${OE_CONFIG}.conf"
157+
if [ $IS_ENTERPRISE = "True" ]; then
158+
sudo su root -c "printf 'addons_path=${OE_HOME}/enterprise/addons,${OE_HOME_EXT}/addons\n' >> /etc/${OE_CONFIG}.conf"
160159
else
161-
sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/${OE_CONFIG}.conf"
160+
sudo su root -c "printf 'addons_path=${OE_HOME_EXT}/addons,${OE_HOME}/custom/addons\n' >> /etc/${OE_CONFIG}.conf"
162161
fi
162+
sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf
163+
sudo chmod 640 /etc/${OE_CONFIG}.conf
163164

164165
echo -e "* Create startup file"
165166
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
242243
sudo chmod 755 /etc/init.d/$OE_CONFIG
243244
sudo chown root: /etc/init.d/$OE_CONFIG
244245

245-
echo -e "* Change default xmlrpc port"
246-
sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/${OE_CONFIG}.conf"
247-
248246
echo -e "* Start ODOO on Startup"
249247
sudo update-rc.d $OE_CONFIG defaults
250248

0 commit comments

Comments
 (0)