Skip to content

Instantly share code, notes, and snippets.

@simesy
Last active December 6, 2019 04:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simesy/1a2114af7494067c026402b54b934fb8 to your computer and use it in GitHub Desktop.
Save simesy/1a2114af7494067c026402b54b934fb8 to your computer and use it in GitHub Desktop.
Export remote config without drush or db.
#!/bin/bash
DOMAIN=${1:-"missing"}
if [[ ${DOMAIN} = "missing" ]] ; then
echo "Pass a Drupal site please, like https://example.com"
exit 1
fi
echo "What is your user name for ${DOMAIN}:"
read USER
echo "What is your password:"
read -s PASS
POST="name=${USER}&pass=${PASS}&form_id=user_login_form&op=Log%20in"
wget \
--keep-session-cookies \
--save-cookies /tmp/some-cookies.txt \
--http-user SHIELDUSER \
--http-password SHIELDPASS \
--post-data ${POST} \
--delete-after \
${DOMAIN}/user/login
wget -O ./config/default/exported-config.tar.gz \
--load-cookies /tmp/some-cookies.txt \
--http-user SHIELDUSER \
--http-password SHIELDPASS \
${DOMAIN}/admin/config/development/configuration/full/export-download
rm -Rf ./config/default/*.yml
tar xzf ./config/default/exported-config.tar.gz -C ./config/default
rm ./config/default/exported-config.tar.gz
git st
echo "Done. Check the output of 'git diff config' above and commit once you're happy."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment