80 lines
No EOL
2.2 KiB
Bash
80 lines
No EOL
2.2 KiB
Bash
#!/bin/bash
|
|
app=odoo
|
|
set -e
|
|
|
|
# Retrieve arguments
|
|
domain=$1
|
|
odoo_version=$2
|
|
admin_password=$3
|
|
|
|
|
|
# Check domain/path availability
|
|
domain=${domain}"/"
|
|
sudo yunohost app checkurl $domain -a $app \
|
|
|| (echo "Path not available: $domain" && exit 1)
|
|
|
|
# Remove trailing "/" for next commands
|
|
domain=${domain%/}
|
|
sudo yunohost app setting $app domain -v $domain
|
|
|
|
if [ -f /usr/bin/openerp-server ]; then
|
|
echo "Odoo is already installed, switching to multi-instances"
|
|
sudo yunohost app setting $app instance -v "slave"
|
|
|
|
else
|
|
sudo yunohost app checkport 8069
|
|
if [[ ! $? -eq 0 ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing odoo"
|
|
sudo yunohost app setting $app version -v $odoo_version
|
|
sudo yunohost app setting $app instance -v "master"
|
|
# Install Odoo
|
|
# Prepare installation
|
|
sudo apt-get -y -qq install curl
|
|
|
|
# Install Odoo
|
|
sudo curl -sS https://nightly.odoo.com/odoo.key | sudo apt-key add -
|
|
if [ "$odoo_version" = "8.0" ]; then
|
|
sudo sh -c 'echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" > /etc/apt/sources.list.d/odoo.list'
|
|
else
|
|
sudo sh -c 'echo "deb http://nightly.odoo.com/9.0/nightly/deb/ ./" > /etc/apt/sources.list.d/odoo.list'
|
|
fi
|
|
sudo apt-get update
|
|
|
|
# Initialize installation
|
|
sudo apt-get -y -qq install postgresql
|
|
su - postgres -c "createuser -s odoo" 2> /dev/null || true
|
|
|
|
sudo apt-get -y -qq install odoo
|
|
|
|
# Install wkhtmltopdf to print PDF reports
|
|
sudo apt-get -y -qq install wkhtmltopdf
|
|
|
|
# Set admin password
|
|
sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/openerp-server.conf
|
|
sudo cp ../conf/openerp-server.conf /etc/odoo/openerp-server.conf
|
|
sudo chown odoo:odoo /etc/odoo/openerp-server.conf
|
|
|
|
# Setup LDAP
|
|
sudo sed -i "s@'auto_install': False@'auto_install': True@g" /usr/lib/python2.7/dist-packages/openerp/addons/auth_ldap/__openerp__.py
|
|
|
|
# Add services
|
|
sudo yunohost service add postgresql
|
|
sudo yunohost service add odoo
|
|
sudo yunohost service stop odoo
|
|
sudo yunohost service start odoo
|
|
fi
|
|
|
|
# Setup database: TO BE DONE
|
|
# Setup LDAP: TO BE DONE
|
|
|
|
# Configure Nginx and reload
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
# Make Odoo public
|
|
sudo yunohost app setting $app skipped_uris -v "/"
|
|
|
|
sudo service nginx reload
|
|
echo $? |