libreerp_ynh/scripts/install

58 lines
1.5 KiB
Text
Raw Normal View History

2015-09-14 17:12:17 +02:00
#!/bin/bash
2015-09-14 17:18:33 +02:00
app=odoo
2015-09-14 17:12:17 +02:00
set -e
# Retrieve arguments
domain=$1
2015-09-14 18:13:54 +02:00
odoo_version=$2
admin_password=$3
2015-09-14 17:12:17 +02:00
sudo yunohost app checkport 8069
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# 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
# Install Odoo
2015-09-14 17:42:46 +02:00
# Prepare installation
sudo apt-get -y install curl
2015-09-14 17:12:17 +02:00
# Install Odoo
2015-09-14 17:42:46 +02:00
sudo curl -sS https://nightly.odoo.com/odoo.key | sudo apt-key add -
2015-09-14 18:23:11 +02:00
if [ "$odoo_version" = "8.0" ]; then
2015-09-14 18:20:51 +02:00
sudo sh -c 'echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" > /etc/apt/sources.list.d/odoo.list'
2015-09-14 18:23:11 +02:00
else
2015-09-14 18:20:51 +02:00
sudo sh -c 'echo "deb http://nightly.odoo.com/9.0/nightly/deb/ ./" > /etc/apt/sources.list.d/odoo.list'
fi
2015-09-14 17:42:46 +02:00
sudo apt-get update
sudo apt-get -y install wkhtmltopdf
sudo apt-get -y install odoo
2015-09-14 17:12:17 +02:00
2015-09-14 18:38:24 +02:00
# Set admin password
sudo sed -i "s@admin_passwd = admin@admin_passwd = $admin_password@g" /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
2015-09-14 17:12:17 +02:00
2015-09-14 17:42:46 +02:00
# Add services
sudo yunohost service add postgresql
sudo yunohost service add odoo
2015-09-14 17:43:17 +02:00
sudo yunohost service stop odoo
sudo yunohost service start odoo
2015-09-14 17:12:17 +02:00
# Configure Nginx and reload
2015-09-14 18:13:54 +02:00
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
2015-09-14 17:12:17 +02:00
2015-09-14 18:13:54 +02:00
# Make Odoo public
2015-09-14 17:12:17 +02:00
sudo yunohost app setting $app skipped_uris -v "/"
sudo service nginx reload
echo $?