X-Git-Url: https://git.ao2.it/drupal-init-tools.git/blobdiff_plain/cce156e037cf0e04db479c4eea768c0a933ae4b2..646a49a82d2501c9bc539facb099e914202e930f:/libexec/create-profile.sh diff --git a/libexec/create-profile.sh b/libexec/create-profile.sh index 96020b3..fae4bcc 100755 --- a/libexec/create-profile.sh +++ b/libexec/create-profile.sh @@ -20,7 +20,7 @@ set -e usage() { cat < +usage: drin $(basename "$0" .sh) [-h|--help] <machine_name> Create an installation profile from the installed project. @@ -47,7 +47,7 @@ do done -[ "x$1" = "x" -o "x$2" = "x" ] && { usage 1>&2; exit 1; } +{ [ "x$1" = "x" ] || [ "x$2" = "x" ]; } && { usage 1>&2; exit 1; } PROFILE_TITLE="$1" PROFILE_MACHINE_NAME="$2" @@ -84,23 +84,22 @@ pushd "$WEB_ROOT" ENABLED_MODULES="$($DRUSH pm-list --type=module --status=enabled --pipe | tr '\n' ',')" ENABLED_THEMES="$($DRUSH pm-list --type=theme --status=enabled --pipe | tr '\n' ',')" -rm -rf "${WEB_ROOT}/profiles/$PROFILE_MACHINE_NAME" $DRUPAL_CONSOLE generate:profile \ --profile="$PROFILE_TITLE" \ --machine-name="$PROFILE_MACHINE_NAME" \ --description="Drupal installation profile for $PROFILE_TITLE" \ - --dependencies=$ENABLED_MODULES \ - --themes=$ENABLED_THEMES \ + --dependencies="$ENABLED_MODULES" \ + --themes="$ENABLED_THEMES" \ + --profile-path="$PROJECT_ROOT" \ --no-interaction -cp -a "${WEB_ROOT}/profiles/${PROFILE_MACHINE_NAME}" "$PROJECT_ROOT" # 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 $DRUPAL_CONSOLE config:export --directory="${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install" --remove-uuid --remove-config-hash rm "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install/core.extension.yml" -# The reference to the core version could be removed, but this is not strictly necessary -#find "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install" -type f -exec sed -i -e '/^_core: { }/d' {} \; +# The reference to the core version could be removed, even though it is not strictly necessary. +find "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install" -type f -exec sed -i -e '/^_core: { }/d' {} \; # Since the profile generated by `$DRUPAL_CONSOLE generate:profile` calls in # the standard profile, some duplicated config files could be removed in the @@ -108,7 +107,7 @@ rm "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install/core.extension.yml" #fdupes -f -1 "${WEB_ROOT}/core/profiles/standard/config/install/" "${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/config/install/" | xargs rm # Export the default content if the default_content module is there -if echo $ENABLED_MODULES | grep -q default_content; +if echo "$ENABLED_MODULES" | grep -q default_content; then $DRUSH default-content-export-references --folder="${PROJECT_ROOT}/${PROFILE_MACHINE_NAME}/content" node fi