Skip to content

Instantly share code, notes, and snippets.

@milansimek
Created February 11, 2015 21:20
Show Gist options
  • Select an option

  • Save milansimek/44fe02a2a97ee9ecc6ff to your computer and use it in GitHub Desktop.

Select an option

Save milansimek/44fe02a2a97ee9ecc6ff to your computer and use it in GitHub Desktop.
Magento batch installer + automatic git adding script for testing. As featured here: https://plugin.company/blog/batch-installing-magento-1-4-1-9-custom-module/
#!/bin/bash
#user data
DBUSER=yourusername #add your mysql user name here
DBPASSW=yourpassword #add your mysql password here
URL='http://test.dev/' #your local www-data URL
GITBASEURL='git@gitlab.com:magento-extensions/' #the 'root' url of your git provider / project group
#end user data
INST=$1
ssh-add;
echo 'magento batch install...';
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}14" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.4.2.0" --installationFolder="./${INST}14" --baseUrl="${URL}${INST}14/";
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}15" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.5.1.0" --installationFolder="./${INST}15" --baseUrl="${URL}${INST}15/";
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}16" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.6.2.0" --installationFolder="./${INST}16" --baseUrl="${URL}${INST}16/";
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}17" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.7.0.2" --installationFolder="./${INST}17" --baseUrl="${URL}${INST}17/";
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}18" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.8.1.0" --installationFolder="./${INST}18" --baseUrl="${URL}${INST}18/";
n98-magerun.phar install --dbHost="localhost" --dbUser="${DBUSER}" --dbPass="${DBPASSW}" --dbName="${INST}19" --installSampleData=yes --useDefaultConfigParams=yes --magentoVersionByName="magento-local-1.9.1.0" --installationFolder="./${INST}19" --baseUrl="${URL}${INST}19/";
echo 'magento batch install done.';
if [ -z ${2+x} ]; then echo "no git repo specified, done.";exit 0;
else
echo "adding ${2} to magento 1.4...";
cd ./${INST}14/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
echo "adding ${2} to magento 1.5...";
cd ../${INST}15/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
echo "adding ${2} to magento 1.6...";
cd ../${INST}16/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
echo "adding ${2} to magento 1.7...";
cd ../${INST}17/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
echo "adding ${2} to magento 1.8...";
cd ../${INST}18/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
echo "adding ${2} to magento 1.9...";
cd ../${INST}19/
git init
git remote add origin ${GITBASEURL}${2}
git fetch --progress --prune origin
git checkout -b master origin/master
cd ../
fi
echo 'running second re-index round...';
pwd
echo "reindexing magento 1.4...";
cd ./${INST}14/
n98-magerun.phar index:reindex:all
pwd
echo "reindexing magento 1.5...";
cd ../${INST}15/
n98-magerun.phar index:reindex:all
pwd
echo "reindexing magento 1.6...";
cd ../${INST}16/
n98-magerun.phar index:reindex:all
pwd
echo "reindexing magento 1.7...";
cd ../${INST}17/
n98-magerun.phar index:reindex:all
pwd
echo "reindexing magento 1.8...";
cd ../${INST}18/
n98-magerun.phar index:reindex:all
pwd
echo "reindexing magento 1.9...";
cd ../${INST}19/
n98-magerun.phar index:reindex:all
cd ../
echo 'done!';
@milansimek
Copy link
Author

If you have any improvements or ideas for this script, let us know!

@milansimek
Copy link
Author

N98 Magerun is required, and opionally setting up a local Magento repository for n98 magerun (https://plugin.company/blog/creating-local-magento-repository-n98-magerun/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment