diff --git a/scripts/install b/scripts/install index d2b7061..8bb8e86 100644 --- a/scripts/install +++ b/scripts/install @@ -24,9 +24,13 @@ sudo yunohost app checkurl $domain -a $app \ # Remove trailing "/" for next commands domain=${domain%/} +# Generate random password +# Fix a bug on ynh_string_random https://github.com/YunoHost/yunohost/pull/205/commits/0d6cf499a0b858e7009245fd11a9210188047c13 +dbpass=$(ynh_string_random | sed "s/\[/e/g" | sed "s/\]/e/g") ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" lang "$lang" +ynh_app_setting_set "$app" psqlpwd "$dbpass" if [ -f /usr/bin/openerp-server ]; then @@ -41,13 +45,9 @@ else echo "Installing odoo" - # Generate random password - # Fix a bug on ynh_string_random https://github.com/YunoHost/yunohost/pull/205/commits/0d6cf499a0b858e7009245fd11a9210188047c13 - dbpass=$(ynh_string_random | sed "s/\[/e/g" | sed "s/\]/e/g") ynh_app_setting_set "$app" version "$odoo_version" ynh_app_setting_set "$app" instance "master" - ynh_app_setting_set "$app" psqlpwd "$dbpass" # Install Odoo # Prepare installation @@ -69,8 +69,10 @@ else ynh_package_install xfonts-75dpi xfonts-base wkhtmltopdf # The debian package has a bug so we deploy a more recent version - extract_sources "/usr/" "$app" - + DESTDIR="/tmp/wkhtmltox/" + mkdir -p $DESTDIR + extract_sources $DESTDIR "$app" + mv "$DESTDIR." /usr/ # Set admin password diff --git a/scripts/remove b/scripts/remove index ce0550d..372e756 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,23 +16,22 @@ database=${domain//./-} instance=$(ynh_app_setting_get "$app" instance) -sudo yunohost service stop odoo +sudo yunohost service stop odoo | true # If removing master instance, remove Odoo. if [ "$instance" = "master" ]; then sudo rm -f /etc/apt/sources.list.d/odoo.list sudo apt-get update ynh_package_remove odoo - ynh_package_remove wkhtmltopdf sudo rm -f /etc/odoo/openerp-server.conf - sudo yunohost service remove odoo + sudo yunohost service remove odoo | true fi # Remove database -ynh_psql_drop_db $database -ynh_psql_drop_user $database +ynh_psql_drop_db $database | true +ynh_psql_drop_user $database | true if [ "$instance" = "slave" ]; then - sudo yunohost service start odoo + sudo yunohost service start odoo | true fi # Remove NGINX conf sudo rm /etc/nginx/conf.d/$domain.d/$app.conf