Automagically run ynh_psql_if_first_run / regenconf upon postgresl install

This commit is contained in:
Alexandre Aubin 2021-11-01 20:14:12 +01:00
parent 4ccd718183
commit b46a94a41d
2 changed files with 11 additions and 0 deletions

View file

@ -261,6 +261,7 @@ ynh_install_app_dependencies() {
dependencies+=", php${specific_php_version}, php${specific_php_version}-fpm, php${specific_php_version}-common"
fi
local psql_installed2="$(dpkg --list | grep -q "ii *postgresql-$PSQL_VERSION" && echo yes || echo no)"
# The first time we run ynh_install_app_dependencies, we will replace the
# entire control file (This is in particular meant to cover the case of
@ -303,6 +304,14 @@ EOF
# Set the default php version back as the default version for php-cli.
update-alternatives --set php /usr/bin/php$YNH_DEFAULT_PHP_VERSION
fi
# Trigger postgresql regenconf if we may have just installed postgresql
local psql_installed2="$(dpkg --list | grep -q "ii *postgresql-$PSQL_VERSION" && echo yes || echo no)"
if [[ "$psql_installed" != "$psql_installed2" ]]
then
yunohost tools regen-conf postgresql
fi
}
# Add dependencies to install with ynh_install_app_dependencies

View file

@ -281,6 +281,8 @@ ynh_psql_remove_db() {
# Create a master password and set up global settings
#
# [internal]
#
# usage: ynh_psql_test_if_first_run
#
# It also make sure that postgresql is installed and running