Silence pushd and popd output
[drupal-init-tools.git] / libexec / create-profile.sh
index 370963d..a8ce396 100755 (executable)
@@ -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