download 1.1 KB

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