Skip to content

Instantly share code, notes, and snippets.

@shorock shorock/sample.sh
Last active Jan 5, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.