download.ps1 839 B

123456789101112131415161718192021222324252627
  1. [CmdletBinding()]
  2. Param(
  3. [Parameter(Mandatory=$True,Position=1)]
  4. [string]$version
  5. )
  6. function Expand-Targz($tarFile, $dest) {
  7. if (Get-Command "7z.exe" -ErrorAction SilentlyContinue) {
  8. & cmd.exe "/C 7z x $tarFile.tar.gz -so | 7z x -aoa -si -ttar -o$dest"
  9. Remove-Item "$tarFile.tar.gz"
  10. }
  11. else {
  12. if (-not (Get-Command Expand-7Zip -ErrorAction Ignore)) {
  13. Install-Package -Scope CurrentUser -Force 7Zip4PowerShell > $null
  14. }
  15. Expand-7Zip "$tarFile.tar.gz" $dest
  16. Expand-7Zip "$tarFile.tar" $dest
  17. Remove-Item "$tarFile.tar.gz"
  18. Remove-Item "$tarFile.tar"
  19. }
  20. }
  21. If( -not (Test-Path -Path .\src) )
  22. {
  23. mkdir .\src | Out-Null
  24. }
  25. Start-BitsTransfer "http://pubfiles.nexcess.net/magento/ce-packages/magento2-$version.tar.gz" ".\src\magento2-$version.tar.gz"
  26. Expand-Targz ".\src\magento2-$version" ".\src"