5656# Update Server
5757# --------------------------------------------------
5858echo -e " \n---- Update Server ----"
59- sudo apt-get update
60- sudo apt-get upgrade -y
59+ apt-get update && apt-get upgrade -y
6160
6261# --------------------------------------------------
6362# Install PostgreSQL Server
6463# --------------------------------------------------
6564echo -e " \n---- Install PostgreSQL Server ----"
66- sudo apt-get install postgresql -y
65+ apt-get install postgresql -y
6766
6867echo -e " \n---- PostgreSQL $PG_VERSION Settings ----"
69- sudo sed -i s/" #listen_addresses = 'localhost'" /" listen_addresses = '*'" /g /etc/postgresql/9.3/main/postgresql.conf
68+ sed -i s/" #listen_addresses = 'localhost'" /" listen_addresses = '*'" /g /etc/postgresql/9.3/main/postgresql.conf # FIXME this line needs to be keept udated or replace version with computed one instead of hardcoded... do we know ahead that posgresql 9.3 will be version installed?
7069
7170echo -e " \n---- Creating the ODOO PostgreSQL User ----"
72- sudo su - postgres -c " createuser -s $OE_USER " 2> /dev/null || true
71+ su - postgres -c " createuser -s $OE_USER " 2> /dev/null || true
7372
7473# --------------------------------------------------
7574# Install Dependencies
7675# --------------------------------------------------
7776echo -e " \n---- Install tool packages ----"
78- sudo apt-get install wget subversion git bzr bzrtools python-pip gdebi-core -y
77+ apt-get install wget subversion git bzr bzrtools python-pip gdebi-core -y
7978
8079echo -e " \n---- Install python packages ----"
81- sudo apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y
80+ apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y
8281
8382echo -e " \n---- Install python libraries ----"
84- sudo pip install gdata
83+ pip install gdata
8584
8685echo -e " \n--- Install other required packages"
87- sudo apt-get install node-clean-css -y
88- sudo apt-get install node-less -y
89- sudo apt-get install python-gevent -y
86+ apt-get install node-clean-css -y
87+ apt-get install node-less -y
88+ apt-get install python-gevent -y
9089
9190# --------------------------------------------------
9291# Install Wkhtmltopdf if needed
@@ -99,51 +98,51 @@ if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
9998 else
10099 _url=$WKHTMLTOX_X32
101100 fi
102- sudo wget $_url
103- sudo gdebi --n ` basename $_url `
104- sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
105- sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
101+ wget $_url
102+ gdebi --n ` basename $_url `
103+ ln -s /usr/local/bin/wkhtmltopdf /usr/bin
104+ ln -s /usr/local/bin/wkhtmltoimage /usr/bin
106105else
107106 echo " Wkhtmltopdf isn't installed due to the choice of the user!"
108107fi
109108
110109echo -e " \n---- Create ODOO system user ----"
111- sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos ' ODOO' --group $OE_USER
110+ adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos ' ODOO' --group $OE_USER
112111# The user should also be added to the sudo'ers group.
113- sudo adduser $OE_USER sudo
112+ adduser $OE_USER sudo
114113
115114echo -e " \n---- Create Log directory ----"
116- sudo mkdir /var/log/$OE_USER
117- sudo chown $OE_USER :$OE_USER /var/log/$OE_USER
115+ mkdir /var/log/$OE_USER
116+ chown $OE_USER :$OE_USER /var/log/$OE_USER
118117
119118# --------------------------------------------------
120119# Install ODOO
121120# --------------------------------------------------
122121echo -e " \n==== Installing ODOO Server ===="
123- sudo git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT /
122+ git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT /
124123
125124echo -e " \n---- Create custom module directory ----"
126- sudo su $OE_USER -c " mkdir $OE_HOME /custom"
127- sudo su $OE_USER -c " mkdir $OE_HOME /custom/addons"
125+ su $OE_USER -c " mkdir $OE_HOME /custom"
126+ su $OE_USER -c " mkdir $OE_HOME /custom/addons"
128127
129128echo -e " \n---- Setting permissions on home folder ----"
130- sudo chown -R $OE_USER :$OE_USER $OE_HOME /*
129+ chown -R $OE_USER :$OE_USER $OE_HOME /*
131130
132131echo -e " * Create server config file"
133- sudo cp $OE_HOME_EXT /debian/openerp-server.conf /etc/${OE_CONFIG} .conf
134- sudo chown $OE_USER :$OE_USER /etc/${OE_CONFIG} .conf
135- sudo chmod 640 /etc/${OE_CONFIG} .conf
132+ cp $OE_HOME_EXT /debian/openerp-server.conf /etc/${OE_CONFIG} .conf
133+ chown $OE_USER :$OE_USER /etc/${OE_CONFIG} .conf
134+ chmod 640 /etc/${OE_CONFIG} .conf
136135
137136echo -e " * Change server config file"
138- sudo sed -i s/" db_user = .*" /" db_user = $OE_USER " /g /etc/${OE_CONFIG} .conf
139- sudo sed -i s/" ; admin_passwd.*" /" admin_passwd = $OE_SUPERADMIN " /g /etc/${OE_CONFIG} .conf
140- sudo su root -c " echo 'logfile = /var/log/$OE_USER /$OE_CONFIG $1 .log' >> /etc/${OE_CONFIG} .conf"
141- sudo su root -c " echo 'addons_path=$OE_HOME_EXT /addons,$OE_HOME /custom/addons' >> /etc/${OE_CONFIG} .conf"
137+ sed -i s/" db_user = .*" /" db_user = $OE_USER " /g /etc/${OE_CONFIG} .conf
138+ sed -i s/" ; admin_passwd.*" /" admin_passwd = $OE_SUPERADMIN " /g /etc/${OE_CONFIG} .conf
139+ su root -c " echo 'logfile = /var/log/$OE_USER /$OE_CONFIG $1 .log' >> /etc/${OE_CONFIG} .conf"
140+ su root -c " echo 'addons_path=$OE_HOME_EXT /addons,$OE_HOME /custom/addons' >> /etc/${OE_CONFIG} .conf"
142141
143142echo -e " * Create startup file"
144- sudo su root -c " echo '#!/bin/sh' >> $OE_HOME_EXT /start.sh"
145- sudo su root -c " echo 'sudo -u $OE_USER $OE_HOME_EXT /openerp-server --config=/etc/${OE_CONFIG} .conf' >> $OE_HOME_EXT /start.sh"
146- sudo chmod 755 $OE_HOME_EXT /start.sh
143+ su root -c " echo '#!/bin/sh' >> $OE_HOME_EXT /start.sh"
144+ su root -c " echo 'sudo -u $OE_USER $OE_HOME_EXT /openerp-server --config=/etc/${OE_CONFIG} .conf' >> $OE_HOME_EXT /start.sh"
145+ chmod 755 $OE_HOME_EXT /start.sh
147146
148147# --------------------------------------------------
149148# Adding ODOO as a deamon (initscript)
@@ -224,18 +223,18 @@ exit 0
224223EOF
225224
226225echo -e " * Security Init File"
227- sudo mv ~ /$OE_CONFIG /etc/init.d/$OE_CONFIG
228- sudo chmod 755 /etc/init.d/$OE_CONFIG
229- sudo chown root: /etc/init.d/$OE_CONFIG
226+ mv ~ /$OE_CONFIG /etc/init.d/$OE_CONFIG
227+ chmod 755 /etc/init.d/$OE_CONFIG
228+ chown root: /etc/init.d/$OE_CONFIG
230229
231230echo -e " * Change default xmlrpc port"
232- sudo su root -c " echo 'xmlrpc_port = $OE_PORT ' >> /etc/${OE_CONFIG} .conf"
231+ su root -c " echo 'xmlrpc_port = $OE_PORT ' >> /etc/${OE_CONFIG} .conf"
233232
234233echo -e " * Start ODOO on Startup"
235- sudo update-rc.d $OE_CONFIG defaults
234+ update-rc.d $OE_CONFIG defaults
236235
237236echo -e " * Starting Odoo Service"
238- sudo su root -c " /etc/init.d/$OE_CONFIG start"
237+ su root -c " /etc/init.d/$OE_CONFIG start"
239238echo " -----------------------------------------------------------"
240239echo " Done! The Odoo server is up and running. Specifications:"
241240echo " Port: $OE_PORT "
0 commit comments