From 072ca3772047549bfb435ba521ef1d4677d0dc27 Mon Sep 17 00:00:00 2001 From: Matthias Stecher Date: Mon, 26 Oct 2020 19:19:49 +0100 Subject: [PATCH] __nextcloud: stricter check configuration values This now checks the configuration value exactly and does not say there are equal if just the end of the string differs. Resulting from this, it will run code the next run if the default port was in a database migration. This was fixed by instantly correct this configuration value. --- type/__nextcloud/map-conf-changes.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/type/__nextcloud/map-conf-changes.sh b/type/__nextcloud/map-conf-changes.sh index caad3bd..5855761 100755 --- a/type/__nextcloud/map-conf-changes.sh +++ b/type/__nextcloud/map-conf-changes.sh @@ -35,7 +35,7 @@ testparam() { # short-circuit after installation; the explorer may not be valid if [ "$install" ]; then return 1; fi - if grep -q -F "$1 = $2" "$__object/explorer/config"; then + if grep -q -Fx "$1 = $2" "$__object/explorer/config"; then return 0 else return 1 @@ -113,7 +113,6 @@ conf_decimal() { # Arguments: # 1: cdist type parameter name # 2: nextcloud config name -# FIXME default value required for booleans? conf_boolean() { # map parameter to a php boolean (are outputted as 0 or 1) if [ -f "$__object/parameter/$1" ]; then @@ -239,6 +238,10 @@ migrate_db() { database_port=5432 ;; esac + + # Correct this value to the value set by the parameter + # this will prevent codegen in the run after the migration + correct_standard_port="yes" fi # print out the correct command @@ -246,6 +249,11 @@ migrate_db() { '%s' '%s' --password '%s' '%s' --port '%u' '%s'\n" \ "$database_type" "$database_user" "$database_pass" "$database_host" "$database_port" "$database_name" printf "php occ maintenance:mode --on\n" # was disabled by database convertion + + # Correct the database host value if it was not correctly set by the migration script + if [ "$correct_standard_port" = "yes" ]; then + printf "php occ config:system:set '%s' --type=string --value '%s'\n" "dbhost" "$database_host" + fi }