From 41855f22bc78c504c68d2f9d1ebde6da7558426c Mon Sep 17 00:00:00 2001 From: Stanislav Zhuk Date: Mon, 28 Oct 2024 19:39:04 +0200 Subject: [PATCH 1/2] Remove Drupal related add-on files from `.ddev` when not applicable --- install.yaml | 9 ++++++++- redis/scripts/setup-drupal-settings.sh | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/install.yaml b/install.yaml index db6b889..ffb411a 100644 --- a/install.yaml +++ b/install.yaml @@ -17,7 +17,14 @@ post_install_actions: - | #ddev-nodisplay #ddev-description:Install redis settings for Drupal 9+ if applicable - redis/scripts/setup-drupal-settings.sh + if ! redis/scripts/setup-drupal-settings.sh; then + for file in redis/scripts/settings.ddev.redis.php redis/scripts/setup-drupal-settings.sh; do + if grep -q "#ddev-generated" "${file}" 2>/dev/null; then + echo "Removing ${file} as not applicable" + rm -f "${file}" + fi + done + fi removal_actions: - | diff --git a/redis/scripts/setup-drupal-settings.sh b/redis/scripts/setup-drupal-settings.sh index 3cad2ee..86243e4 100755 --- a/redis/scripts/setup-drupal-settings.sh +++ b/redis/scripts/setup-drupal-settings.sh @@ -4,11 +4,11 @@ set -e if [[ $DDEV_PROJECT_TYPE != drupal* ]] || [[ $DDEV_PROJECT_TYPE =~ ^drupal(6|7)$ ]] ; then - exit 0 + exit 1 fi if ( ddev debug configyaml 2>/dev/null | grep 'disable_settings_management:\s*true' >/dev/null 2>&1 ) ; then - exit 0 + exit 2 fi cp redis/scripts/settings.ddev.redis.php $DDEV_APPROOT/$DDEV_DOCROOT/sites/default/ From ca71cfda555433c893f096ced0fde12d0cfb4a00 Mon Sep 17 00:00:00 2001 From: Stanislav Zhuk Date: Tue, 29 Oct 2024 21:46:37 +0200 Subject: [PATCH 2/2] Remove files from the script --- install.yaml | 9 +-------- redis/scripts/setup-drupal-settings.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/install.yaml b/install.yaml index ffb411a..db6b889 100644 --- a/install.yaml +++ b/install.yaml @@ -17,14 +17,7 @@ post_install_actions: - | #ddev-nodisplay #ddev-description:Install redis settings for Drupal 9+ if applicable - if ! redis/scripts/setup-drupal-settings.sh; then - for file in redis/scripts/settings.ddev.redis.php redis/scripts/setup-drupal-settings.sh; do - if grep -q "#ddev-generated" "${file}" 2>/dev/null; then - echo "Removing ${file} as not applicable" - rm -f "${file}" - fi - done - fi + redis/scripts/setup-drupal-settings.sh removal_actions: - | diff --git a/redis/scripts/setup-drupal-settings.sh b/redis/scripts/setup-drupal-settings.sh index 86243e4..c3b375a 100755 --- a/redis/scripts/setup-drupal-settings.sh +++ b/redis/scripts/setup-drupal-settings.sh @@ -4,11 +4,17 @@ set -e if [[ $DDEV_PROJECT_TYPE != drupal* ]] || [[ $DDEV_PROJECT_TYPE =~ ^drupal(6|7)$ ]] ; then - exit 1 + for file in redis/scripts/settings.ddev.redis.php redis/scripts/setup-drupal-settings.sh; do + if grep -q "#ddev-generated" "${file}" 2>/dev/null; then + echo "Removing ${file} as not applicable" + rm -f "${file}" + fi + done + exit 0 fi if ( ddev debug configyaml 2>/dev/null | grep 'disable_settings_management:\s*true' >/dev/null 2>&1 ) ; then - exit 2 + exit 0 fi cp redis/scripts/settings.ddev.redis.php $DDEV_APPROOT/$DDEV_DOCROOT/sites/default/