Last active
January 5, 2019 02:23
-
-
Save shorock/70f98f2ca18d30144c17d2cb2c9c7000 to your computer and use it in GitHub Desktop.
drush and jq hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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