download 1.3 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. [ -z "$1" ] && echo "Please specify the version to download (ex. 2.0.0)" && exit
  3. edition=${2:-community}
  4. if [[ "$edition" == "enterprise" ]]; then
  5. composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-enterprise-edition=$1 src
  6. exit 0
  7. fi
  8. if [ ! -f ~/.docker-magento/magento2-$1.tar.gz ]; then
  9. mkdir -p ~/.docker-magento
  10. (cd ~/.docker-magento && curl -OL http://pubfiles.nexcess.net/magento/ce-packages/magento2-$1.tar.gz)
  11. fi
  12. # Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
  13. if [ $(find ~/.docker-magento/magento2-$1.tar.gz -size -1M) ]; then
  14. (cd ~/.docker-magento && curl -o magento2-$1.tar.gz -OL https://www.magento.mirror.hypernode.com/releases/magento-$1.tar.gz)
  15. fi
  16. # Final fallback. If no archive exists, let's use Composer!
  17. if [ $(find ~/.docker-magento/magento2-$1.tar.gz -size -1M) ]; then
  18. echo "Archive not found, or not yet available due to new version release."
  19. echo "Attempting install with Composer..."
  20. rm -rf src
  21. composer create-project --repository=https://repo.magento.com/ --ignore-platform-reqs magento/project-community-edition=$1 src
  22. else
  23. echo "Extracting magento2-$1.tar.gz to ./src"
  24. mkdir -p src && tar xzf ~/.docker-magento/magento2-$1.tar.gz -o -C src
  25. fi