Last active
December 6, 2019 04:44
-
-
Save simesy/1a2114af7494067c026402b54b934fb8 to your computer and use it in GitHub Desktop.
Export remote config without drush or db.
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 | |
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