diff --git a/scripts/install b/scripts/install index 53becc3..46b7065 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,15 +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 "createuser -s odoo" 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 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 @@ -74,6 +73,15 @@ else sudo yunohost service start odoo fi +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 diff --git a/scripts/remove b/scripts/remove index 971f0b4..980cf35 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,11 +10,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 @@ -22,4 +20,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