From cf05091ce591bc1bab8b3ba0175fb36af3d6bebe Mon Sep 17 00:00:00 2001 From: Douze Baie <12b@distrilab.fr> Date: Fri, 14 Jun 2024 14:43:47 +0200 Subject: [PATCH 1/3] Add yunohost_sso_domain config param durign upgrade if it does not exists --- scripts/upgrade | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 9ff7715..887e27e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,10 +86,13 @@ ynh_add_config --template="sync_app_importer.sh" --destination="/etc/yunohost/ho chown root:root /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh -# ToDo : Add importer config in wakka.config.php if it is not already there ? -# if [ ??? ]; then -# ynh_replace_string --match_string=");" --replace_string=" 'dataSources' => [\n'yunohost-cli' => [\n'formId' => '5', // form id used in local bazar\n'lang' > -# fi +# ToDo : Add app importer config in wakka.config.php if it is not already there ? + +if [ ${grep yunohost_sso_domain "$install_dir/wakka.config.php"} = "0" ]; then + SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') + ynh_replace_string --match_string=");" --replace_string=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --target_file="$install_dir/wakka.config.php" +fi + # At last, run the YunoHost app importer ynh_script_progression --message="Import YunoHost apps in bazar" --weight=2 From a49bd2ed42579421fe9f81ab4bd51ab075c12a13 Mon Sep 17 00:00:00 2001 From: Douze Baie <12b@distrilab.fr> Date: Fri, 14 Jun 2024 14:55:36 +0200 Subject: [PATCH 2/3] fix typo --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 887e27e..6bbfc60 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh # ToDo : Add app importer config in wakka.config.php if it is not already there ? -if [ ${grep yunohost_sso_domain "$install_dir/wakka.config.php"} = "0" ]; then +if [ $(grep yunohost_sso_domain "$install_dir/wakka.config.php") = "0" ]; then SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') ynh_replace_string --match_string=");" --replace_string=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --target_file="$install_dir/wakka.config.php" fi From c454e9bcbc17f9f42dcd67e71781d6adeece0afa Mon Sep 17 00:00:00 2001 From: Douze Baie <12b@distrilab.fr> Date: Fri, 14 Jun 2024 15:09:52 +0200 Subject: [PATCH 3/3] fix test that is checking if config param exists --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6bbfc60..48fa7b3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ chmod +x /etc/yunohost/hooks.d/post_app_install/${app}_sync_app_importer.sh # ToDo : Add app importer config in wakka.config.php if it is not already there ? -if [ $(grep yunohost_sso_domain "$install_dir/wakka.config.php") = "0" ]; then +if [ $(grep yunohost_sso_domain "$install_dir/wakka.config.php" | wc -l) = "0" ]; then SSO_DOMAIN=$(yunohost domain main-domain | sed -e 's/.*: //') ynh_replace_string --match_string=");" --replace_string=" 'yunohost_sso_domain' => '${SSO_DOMAIN}',\n);" --target_file="$install_dir/wakka.config.php" fi