[fix] Install postgresql before configure it

This commit is contained in:
ljf 2018-12-14 20:21:31 +01:00
parent be2451d872
commit 78de1d5ec1
3 changed files with 9 additions and 39 deletions

View file

@ -6,6 +6,7 @@ set -eu
source /usr/share/yunohost/helpers
#source _future.sh
source ../settings/scripts/_common.sh
ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)

View file

@ -37,40 +37,6 @@ ynh_webpath_register $app $domain "/"
#=================================================
# SETUP THE APP BY MODIFYING THE SYSTEM
#=================================================
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 <a[^>]*>Odoo<\/a>//g' {} \;
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>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 <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml
sed -i 's/<a[^>]*>Documentation<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml
sed -i 's/<a[^>]*>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
}
function setup_database() {
@ -106,12 +72,13 @@ self.env.cr.commit()
"
}
ynh_save_args domain app_version oca lang tz final_path conf_file db_name port port_chat
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name
export db_pass=$(ynh_app_setting_get $app psqlpwd)
ynh_system_user_create $app $final_path
export db_pass=$(ynh_string_random)
setup_files
install_dependencies
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name $db_pass
export db_pass=$(ynh_app_setting_get $app psqlpwd)
ynh_configure_nginx
add_services
setup_database

View file

@ -15,6 +15,8 @@ export oca=$(ynh_app_setting_get $app oca)
export port=$(ynh_app_setting_get $app port)
export port_chat=$(ynh_app_setting_get $app port_chat)
export db_name=$(ynh_app_setting_get $app db_name)
export db_pass=$(ynh_app_setting_get $app psqlpwd)
export final_path=$(ynh_app_setting_get $app final_path)
export is_public=0
#=================================================
@ -39,11 +41,11 @@ function restore_database () {
su -c "psql $app" postgres < ./dump.sql
}
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name $db_pass
ynh_system_user_create $app $final_path
restore_files
install_dependencies
ynh_psql_test_if_first_run
ynh_psql_setup_db $db_name $db_name $db_pass
add_services
restore_database
ssowat_and_restart