Skip to content

Instantly share code, notes, and snippets.

@shorock
Last active January 5, 2019 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shorock/70f98f2ca18d30144c17d2cb2c9c7000 to your computer and use it in GitHub Desktop.
Save shorock/70f98f2ca18d30144c17d2cb2c9c7000 to your computer and use it in GitHub Desktop.
drush and jq hack
#!/bin/bash
# Danger, if you don't do this and 'drush status' fails for some other reason, the pipeline exits 0
# and thus tries to site-install again
set -o pipelinefail
is_drupal_installed() {
cd /app/web
drush status --pipe | jq -e '.bootstrap == "Successful"' > /dev/null
}
## Much other code
# Do a drush site-install if needed
if ! is_drupal_installed
then
cd /app/web
yes | drush site-install --account-pass="$ADMIN_PASSWORD" --site-name="$SITE_NAME" "${DRUPAL_PROFILE:-standard}"
fi
## Much more code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment