diff --git a/README.md b/README.md
index a0bc048..8deb0e7 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,13 @@
+Odoo
+----
+
+Odoo is a suite of web based open source business apps.
+
+The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...
+
+Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get
+a full-featured Open Source ERP when you install several Apps.
+
Odoo for YunoHost
----------------------------
Warning: This YunoHost app is still in development. Use it at your own risk! I am **not** responsible for any data loss that jeopardizes your organization
@@ -12,12 +22,24 @@ https://example.com/odoo/ will NOT work
What does not work
------------------
+- Automatic database creation (experimental)
+- Backup and restore via Odoo (works with a trick shared on the Github)
- Backup and restore via YunoHost
-- Automatic database creation
- Automatic LDAP configuration
+Still to do
+-----------
+- Automatic LDAP setup + emails
+- Backup/restore via Odoo fix
+- Backup/restore via YunoHost
+- SMTP settings
+
+
Configuration
-------------
+**Create the database manually**
+- The database must be named "*subdomain-domain-tld*" (for example *erp-test-com* if you access the database via *erp.test.com*
+
**Setup LDAP**
- Create a user named "template" with email "template". This user will give its permissions by default to YunoHost users so you can also give it appropriate permissions.
- In "Edit Company Data" (on the logo), go to "Configuration" and add a LDAP setting
@@ -39,14 +61,3 @@ Configuration
- Go to manage databases and delete the old database
- Restore
- **Important!** The database must be named "*subdomain-domain-tld*" (for example *erp-test-com* if you access the database via *erp.test.com*
-
-
-Odoo
-----
-
-Odoo is a suite of web based open source business apps.
-
-The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...
-
-Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get
-a full-featured Open Source ERP when you install several Apps.
\ No newline at end of file
diff --git a/scripts/install b/scripts/install
index a80cbc5..49183ed 100644
--- a/scripts/install
+++ b/scripts/install
@@ -9,6 +9,8 @@ admin_password=$3
database_password=$4
database_lang=$5
+
+
# Check domain/path availability
domain=${domain}"/"
sudo yunohost app checkurl $domain -a $app \
@@ -46,16 +48,12 @@ else
# Initialize installation
sudo apt-get -y -qq install postgresql
- su - postgres -c "createuser -s odoo" 2> /dev/null || true
+ sudo su - postgres -c "echo \"CREATE USER odoo WITH PASSWORD '$admin_password' CREATEDB;\" | psql" 2> /dev/null || true
sudo apt-get -y -qq install odoo
# Install wkhtmltopdf to print PDF reports
- sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
- sudo dpkg -i wkhtmltox-0.12.2.1_linux-jessie-amd64.deb
- sudo apt-get -y -qq install xfonts-75dpi
- sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
- sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
+ sudo apt-get -yf -qq install wkhtmltopdf
# Set admin password
sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/openerp-server.conf
@@ -66,7 +64,7 @@ else
sudo sed -i "s@'auto_install': False@'auto_install': True@g" /usr/lib/python2.7/dist-packages/openerp/addons/auth_ldap/__openerp__.py
# Install oerplib to manage databases
- sudo pip install oerplib
+ #sudo pip install oerplib
# Add services
sudo yunohost service add postgresql
@@ -75,12 +73,21 @@ else
sudo yunohost service start odoo
fi
-# Setup database
- sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/install_database.py
- sudo sed -i "s@DOMAIN_DATABASE@${domain//./-}@g" ../conf/install_database.py
- sudo sed -i "s@DATABASE_LANG@$database_lang@g" ../conf/install_database.py
- sudo sed -i "s@DATABASE_PASSWORD@$database_password@g" ../conf/install_database.py
- sudo python ../conf/install_database.py
+function exit_properly
+{
+ set +e
+ # TODO: uninstall db
+ sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
+ sudo service nginx reload
+ exit 1
+}
+trap exit_properly ERR
+# Setup database: not working
+#sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/install_database.py
+#sudo sed -i "s@DOMAIN_DATABASE@${domain//./-}@g" ../conf/install_database.py
+#sudo sed -i "s@DATABASE_LANG@$database_lang@g" ../conf/install_database.py
+#sudo sed -i "s@DATABASE_PASSWORD@$database_password@g" ../conf/install_database.py
+#sudo python ../conf/install_database.py
# Setup LDAP: TO BE DONE
@@ -91,4 +98,4 @@ fi
sudo yunohost app setting $app skipped_uris -v "/"
sudo service nginx reload
-echo $?
\ No newline at end of file
+echo $?
diff --git a/scripts/remove b/scripts/remove
index 02da2e7..2f3c61f 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -11,11 +11,9 @@ instance=$(sudo yunohost app setting $app instance)
if [ "$instance" = "master" ]; then
# Remove Odoo
sudo yunohost service stop odoo
- sudo yunohost service stop postgresql
sudo apt-get remove odoo -y
sudo apt-get remove wkhtmltopdf -y
sudo yunohost service remove odoo
- sudo yunohost service remove postgresql
fi
# Remove NGINX conf
@@ -23,4 +21,4 @@ instance=$(sudo yunohost app setting $app instance)
# Reload
sudo service nginx reload
- sudo yunohost app ssowatconf
\ No newline at end of file
+ sudo yunohost app ssowatconf