1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00

[enh] Trap error

[fix] Wkhtmltopdf from official repo
[fix] Missing sudo to create postgres user
This commit is contained in:
zamentur 2015-10-30 18:02:03 +01:00
parent 2b1c7a7c2e
commit a34cd3abff
2 changed files with 14 additions and 8 deletions

View file

@ -9,6 +9,8 @@ admin_password=$3
database_password=$4 database_password=$4
database_lang=$5 database_lang=$5
# Check domain/path availability # Check domain/path availability
domain=${domain}"/" domain=${domain}"/"
sudo yunohost app checkurl $domain -a $app \ sudo yunohost app checkurl $domain -a $app \
@ -46,15 +48,12 @@ else
# Initialize installation # Initialize installation
sudo apt-get -y -qq install postgresql 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 sudo apt-get -y -qq install odoo
# Install wkhtmltopdf to print PDF reports # 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 apt-get -yf -qq install wkhtmltopdf
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
# Set admin password # Set admin password
sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/openerp-server.conf sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/openerp-server.conf
@ -74,6 +73,15 @@ else
sudo yunohost service start odoo sudo yunohost service start odoo
fi 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 # Setup database: not working
# sudo sed -i "s@ADMIN_PASSWORD@$admin_password@g" ../conf/install_database.py # 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@DOMAIN_DATABASE@${domain//./-}@g" ../conf/install_database.py

View file

@ -10,11 +10,9 @@ instance=$(sudo yunohost app setting $app instance)
if [ "$instance" = "master" ]; then if [ "$instance" = "master" ]; then
# Remove Odoo # Remove Odoo
sudo yunohost service stop odoo sudo yunohost service stop odoo
sudo yunohost service stop postgresql
sudo apt-get remove odoo -y sudo apt-get remove odoo -y
sudo apt-get remove wkhtmltopdf -y sudo apt-get remove wkhtmltopdf -y
sudo yunohost service remove odoo sudo yunohost service remove odoo
sudo yunohost service remove postgresql
fi fi
# Remove NGINX conf # Remove NGINX conf