X-Git-Url: https://git.ao2.it/drupal-init-tools.git/blobdiff_plain/e8e93f39e2a93a09156b0e79a24d789454884c9c..3451b71196a4beb632d7f9d37fdeee6ce4b4a811:/libexec/create-profile.sh diff --git a/libexec/create-profile.sh b/libexec/create-profile.sh index 370963d..a8ce396 100755 --- a/libexec/create-profile.sh +++ b/libexec/create-profile.sh @@ -68,7 +68,7 @@ PROFILE_DEST_DIR="${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}" [ -d "${PROFILE_DEST_DIR}" ] && { echo "Aborting, '${PROFILE_DEST_DIR}' already exists." 1>&2; exit 1; } -pushd "$WEB_ROOT" +pushd "$WEB_ROOT" > /dev/null CURRENT_PROFILE="$($DRUSH php-eval "echo drupal_get_profile();")" CURRENT_PROFILE_PATH="$($DRUSH php-eval "echo drupal_get_path('profile', '${CURRENT_PROFILE}');")" @@ -101,7 +101,7 @@ $DRUPAL_CONSOLE generate:profile \ --no-interaction # Copy private code and data from the currently installed profile -pushd "$CURRENT_PROFILE_PATH" +pushd "$CURRENT_PROFILE_PATH" > /dev/null find . -maxdepth 1 -type d ! -name "tests" -printf "%P\n" | while read -r dir; @@ -116,11 +116,14 @@ find . -maxdepth 1 -type f ! -name "*.info.yml" -printf "%P\n" | cp "${original_file}" "$DESTINATION_FILE" if file "$original_file" | grep -q PHP; then - sed -i "s/^function ${CURRENT_PROFILE}_/function ${PROFILE_MACHINE_NAME}_/g" "$DESTINATION_FILE" + sed -i \ + -e "s/^function ${CURRENT_PROFILE}_/function ${PROFILE_MACHINE_NAME}_/g" \ + -e "s/\$form\['#submit'\]\[\] = '${CURRENT_PROFILE}_/\$form\['#submit'\]\[\] = '${PROFILE_MACHINE_NAME}_/g" \ + "$DESTINATION_FILE" fi done -popd +popd > /dev/null # Basically do what's suggested in the "Configuration" section here: # https://www.drupal.org/docs/8/creating-distributions/how-to-write-a-drupal-8-installation-profile @@ -149,4 +152,4 @@ then echo "Check that the code of the created profile refers to the new profile name." fi -popd +popd > /dev/null