From ff40973728905326fcefd28f5400c408fadcdd47 Mon Sep 17 00:00:00 2001 From: ljf Date: Fri, 14 Dec 2018 19:49:43 +0100 Subject: [PATCH] [fix] Odoo references after upgrade --- scripts/_common.sh | 34 ++++++++++++++++++++++++++++++++++ scripts/upgrade | 10 +--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 04c1b4f..40dd478 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,6 +6,40 @@ export APPNAME="libreerp" export FORKNAME="odoo" DEPENDENCIES="curl postgresql xfonts-75dpi xfonts-base wkhtmltopdf node-less python3-dev gcc libldap2-dev libssl-dev libsasl2-dev python3-pip python3-dev python3-venv python3-wheel libxslt-dev libzip-dev python3-setuptools python-virtualenv python-wheel python-setuptools libjpeg-dev zlib1g-dev" +function setup_files() { + + ynh_setup_source $final_path/$APPNAME $app_version + + # Remove Odoo references to avoid trademark issue + if [ -d $final_path/$APPNAME/$FORKNAME ]; then + python_app=$final_path/$APPNAME/$FORKNAME + else + python_app=$final_path/$APPNAME/openerp + fi + find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by ]*>Odoo<\/a>//g' {} \; + find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \; + find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \; + find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>]*Odoo[^>]*><\/a>//g' {} \; + sed -i 's/]*>My Odoo.com account<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml + sed -i 's/]*>Documentation<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml + sed -i 's/]*>Support<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml + cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png + mkdir -p $final_path/custom-addons + chown -R $app:$app $final_path + ynh_configure server.conf $conf_file + chown $app:$app $conf_file + + # Autoinstall the LDAP auth module + if ls $final_path/$APPNAME/$FORKNAME-bin > /dev/null ; then + ynh_replace_string "^{$" "{'auto_install': True," ${final_path}/$APPNAME/addons/auth_ldap/__manifest__.py + else + ynh_replace_string "'auto_install': False" "'auto_install': True" ${final_path}/$APPNAME/addons/auth_ldap/__openerp__.py + fi + + touch /var/log/$app.log + chown $app:$app /var/log/$app.log + +} # Install dependencies function install_dependencies() { ynh_add_swap 1024 diff --git a/scripts/upgrade b/scripts/upgrade index 3cb3989..0d3776e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -69,14 +69,6 @@ if ynh_version_le "11.0-1" ; then fi ynh_system_user_create $app -ynh_setup_source "$final_path/$APPNAME" $app_version -mkdir -p $final_path/custom-addons -chown -R $app:$app $final_path -ynh_configure server.conf $conf_file -chown $app:$app $conf_file - -touch /var/log/$app.log -chown $app:$app /var/log/$app.log - +setup_files install_dependencies service $app restart