Browse Source

Add check if archive is corrupted

Closes #359
Piotr Kwiecinski 4 years ago
parent
commit
59a1784330
1 changed files with 2 additions and 2 deletions
  1. 2 2
      compose/bin/download

+ 2 - 2
compose/bin/download

@@ -16,12 +16,12 @@ if [ ! -f ~/.docker-magento/magento2-"$1".tar.gz ]; then
 fi
 fi
 
 
 # Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
 # Fallback download to hypernode if archive doesn't exist on Nexcess (smaller than 1MB)
-if [ "$(find ~/.docker-magento/magento2-"$1".tar.gz -size -1M)" ]; then
+if ! tar -tzf  ~/.docker-magento/magento2-"$1".tar.gz -O &>/dev/null; then
     (cd ~/.docker-magento && curl -o magento2-"$1".tar.gz -fOL https://www.magento.mirror.hypernode.com/releases/magento-"$1".tar.gz)
     (cd ~/.docker-magento && curl -o magento2-"$1".tar.gz -fOL https://www.magento.mirror.hypernode.com/releases/magento-"$1".tar.gz)
 fi
 fi
 
 
 # Final fallback. If no archive exists, let's use Composer!
 # Final fallback. If no archive exists, let's use Composer!
-if [ ! -f ~/.docker-magento/magento2-"$1".tar.gz ]; then
+if ! tar -tzf  ~/.docker-magento/magento2-"$1".tar.gz -O &>/dev/null; then
     echo "Archive not found, or not yet available due to new version release."
     echo "Archive not found, or not yet available due to new version release."
     echo "Attempting install with Composer..."
     echo "Attempting install with Composer..."
     rm -rf src
     rm -rf src