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:
parent
2b1c7a7c2e
commit
a34cd3abff
2 changed files with 14 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue