[ -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}');")"
--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;
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
#fdupes -f -1 "${WEB_ROOT}/core/profiles/standard/config/install/" "${PROFILE_DEST_DIR}/config/install/" | xargs rm
# Export the default content if the default_content module is there
-if echo "$ENABLED_MODULES" | grep -q default_content;
+if $DRUSH pm-list --type=module --field=name --status=enabled --pipe | grep -q "^default_content$";
then
$DRUSH default-content-export-references --folder="${PROFILE_DEST_DIR}/content" node
fi
echo "Check that the code of the created profile refers to the new profile name."
fi
-popd
+popd > /dev/null