Skip to content

Commit

Permalink
faster setups dowload speed using SilentlyContinue
Browse files Browse the repository at this point in the history
  • Loading branch information
MRColorR committed Nov 30, 2022
1 parent 297ece4 commit 8499c8f
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 107 deletions.
16 changes: 10 additions & 6 deletions .resources/.scripts/install-docker-mac.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# if a flag is provided it will install Docker for mac with intelCPU
param(
[string(Mandatory)]$filePath,
[Parameter(Mandatory)][string]$filePath,
[switch]$IntelCPU
)
$cpu = ""
Write-Host "Downloading Docker setup files, please wait... "
if ($IntelCPU) {
$cpu = "Intel"
#Invoke-WebRequest https://desktop.docker.com/mac/main/amd64/Docker.dmg -o "$filePath/Docker.dmg";
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest https://desktop.docker.com/mac/main/amd64/Docker.dmg -o "$filePath/Docker.dmg";
$ProgressPreference = 'Continue'
}else {
$cpu = "Apple silicon arm"
#Invoke-WebRequest https://desktop.docker.com/mac/main/arm64/Docker.dmg -o "$filePath/Docker.dmg";
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest https://desktop.docker.com/mac/main/arm64/Docker.dmg -o "$filePath/Docker.dmg";
$ProgressPreference = 'Continue'
}
Read-Host -Prompt "Ready. Press enter to install Docker for Mac with $cpu CPU"
Write-Output "Installing Docker for $cpu CPU, please wait..."
sudo hdiutil attach "$filePath/Docker.dmg"
sudo /Volumes/Docker/Docker.app/Contents/MacOS/install --accept-license
sudo hdiutil detach /Volumes/Docker
open /Applications/Docker.app

open /Applications/Docker.app
107 changes: 55 additions & 52 deletions .resources/.scripts/install-docker-win.ps1
Original file line number Diff line number Diff line change
@@ -1,71 +1,74 @@
set-executionpolicy -scope CurrentUser -executionPolicy Bypass -Force
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# Relaunch as an elevated process:
Start-Process powershell.exe "-File", ('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}
$RESOURCES_DIR = (get-item $PWD ).parent.FullName
$SCRIPTS_DIR = "$RESOURCES_DIR\.scripts"
$FILES_DIR = "$RESOURCES_DIR\.files"


function installDoker {
Write-Output "Downloading the Docker exe"
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerInstaller.exe -UseBasicParsing
Write-Output "Download Completed"
Write-Host "Downloading Docker setup files, please wait... "
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerInstaller.exe
$ProgressPreference = 'Continue'
Write-Output "Download Completed"

Write-Output "Installing Docker please wait..."
start-process .\DockerInstaller.exe -Wait -NoNewWindow -ArgumentList "install --accept-license --quiet"
Copy-Item "$FILES_DIR\docker-default-settings.json" -Destination "$env:AppData\Docker\settings.json"
Write-Output "Docker Installed successfully"
Read-Host "You must reboot the sytem to continue. After reboot re-run the script and proceed with the next steps (e.g. .env setup and start stack)"
Restart-Computer -Confirm
Write-Output "Installing Docker please wait..."
start-process .\DockerInstaller.exe -Wait -NoNewWindow -ArgumentList "install --accept-license --quiet"
Copy-Item "$FILES_DIR\docker-default-settings.json" -Destination "$env:AppData\Docker\settings.json"
Write-Output "Docker Installed successfully"
Read-Host "You must reboot the sytem to continue. After reboot re-run the script and proceed with the next steps (e.g. .env setup and start stack)"
Restart-Computer -Confirm
}

$ProgressPreference = 'Continue'

$wsl = Get-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online
$wsl = Get-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online

if($wsl.State -eq "Enabled") {
if ($wsl.State -eq "Enabled") {

Write-Output "WSL is enabled."
Write-Output "WSL is enabled."

if ([Environment]::Is64BitOperatingSystem)
{
Write-Output "System is x64. Need to update Linux kernel..."
if (-not (Test-Path wsl_update_x64.msi))
{
Write-Output "Downloading Linux kernel update package..."
Invoke-WebRequest -OutFile wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
}
Write-Output "Installing Linux kernel update package..."
Start-Process msiexec.exe -Wait -ArgumentList '/I wsl_update_x64.msi /quiet'
Write-Output "Linux kernel update package installed."
if ([Environment]::Is64BitOperatingSystem) {
Write-Output "System is x64. Need to update Linux kernel..."
if (-not (Test-Path wsl_update_x64.msi)) {
Write-Output "Downloading Linux kernel update package..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
$ProgressPreference = 'Continue'
}
Write-Output "Installing Linux kernel update package..."
Start-Process msiexec.exe -Wait -ArgumentList '/I wsl_update_x64.msi /quiet'
Write-Output "Linux kernel update package installed."
}

Write-Output "WSL is enabled. Setting it to WSL2"
wsl --set-default-version 2
Write-Output "WSL is enabled. Setting it to WSL2"
wsl --set-default-version 2

if(Test-Path 'C:\Program Files\Docker\Docker\Docker Desktop.exe' -PathType Leaf){
$yn=Read-Host -Prompt 'It seems Docker is already installed in your system. Do you want to reinstall/repair it Y/N?'
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ){
installDoker
} else {
Write-Output 'Docker installation/repair canceled.'
Write-Output 'If docker was already correctly installed on your system you should be able to proceed with the next steps anyway'
}
} else {
Write-Output 'It seems that Docker is not installed on the system, the installation is starting'
if (Test-Path 'C:\Program Files\Docker\Docker\Docker Desktop.exe' -PathType Leaf) {
$yn = Read-Host -Prompt 'It seems Docker is already installed in your system. Do you want to reinstall/repair it Y/N?'
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ) {
installDoker
}

}
else {
Write-Output 'Docker installation/repair canceled.'
Write-Output 'If docker was already correctly installed on your system you should be able to proceed with the next steps anyway'
}
}
else {
Write-Output "WSL is disabled."
Write-Output "Enabling WSL2 feature now. You will then restart your machine and execute the install docker option of the script again to complete the docker installation"
Write-Output 'It seems that Docker is not installed on the system, the installation is starting'
installDoker
}

}
else {
Write-Output "WSL is disabled."
Write-Output "Enabling WSL2 feature now. You will then restart your machine and execute the install docker option of the script again to complete the docker installation"

& cmd /c 'dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart'
& cmd /c 'dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart'
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Start-Sleep 30
Write-Output "WSL is enabled now reboot the system and re-run the script to continue the docker installation."
}
& cmd /c 'dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart'
& cmd /c 'dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart'
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Start-Sleep 30
Write-Output "WSL is enabled now reboot the system and re-run the script to continue the docker installation."
}
101 changes: 52 additions & 49 deletions .resources/.scripts/install-docker.ps1
Original file line number Diff line number Diff line change
@@ -1,73 +1,76 @@
set-executionpolicy -scope CurrentUser -executionPolicy Bypass -Force
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# Relaunch as an elevated process:
Start-Process powershell.exe "-File", ('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}
$RESOURCES_DIR = (get-item $PWD ).parent.FullName
$SCRIPTS_DIR = "$RESOURCES_DIR\.scripts"
$FILES_DIR = "$RESOURCES_DIR\.files"
function installDoker {
Write-Output "Downloading the Docker exe"
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerInstaller.exe -UseBasicParsing
Write-Output "Download Completed"
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile DockerInstaller.exe -UseBasicParsing
$ProgressPreference = 'Continue'
Write-Output "Download Completed"

Write-Output "Installing Docker please wait..."
start-process .\DockerInstaller.exe -Wait -NoNewWindow -ArgumentList "install --accept-license --quiet"
Copy-Item "$FILES_DIR\docker-default-settings.json" -Destination "$env:AppData\Docker\settings.json"
Write-Output "Docker Installed successfully"
Read-Host "You must reboot the sytem to continue. After reboot re-run the script and proceed with the next steps (e.g. .env setup and start stack)"
Restart-Computer -Confirm
Write-Output "Installing Docker please wait..."
start-process .\DockerInstaller.exe -Wait -NoNewWindow -ArgumentList "install --accept-license --quiet"
Copy-Item "$FILES_DIR\docker-default-settings.json" -Destination "$env:AppData\Docker\settings.json"
Write-Output "Docker Installed successfully"
Read-Host "You must reboot the sytem to continue. After reboot re-run the script and proceed with the next steps (e.g. .env setup and start stack)"
Restart-Computer -Confirm
}

$ProgressPreference = 'Continue'
Write-Output "NOTE: IF YOU READ THIS MESSAGE YOU ARE USING AN OLD VERSION OF THE MONEY4BAND PROJECT. PLEASE DOWNLOAD THE LATEST VERSION FROM https://github.com/MRColorR/money4band"
Write-Output "THIS IS NOW A LEGACY SCRIPT,EVEN IF IT IS STILL USABLE AND WORKING, IT IS CONSIDERED DEPRECATED AND IS ONLY PRESENT TO PROVIDE SUPPORT TO PREVIOUS VERSIONS OF THE MONEY4BAND PROJECT. "

$wsl = Get-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online
$wsl = Get-WindowsOptionalFeature -FeatureName Microsoft-Windows-Subsystem-Linux -Online

if($wsl.State -eq "Enabled") {
if ($wsl.State -eq "Enabled") {

Write-Output "WSL is enabled."
Write-Output "WSL is enabled."

if ([Environment]::Is64BitOperatingSystem)
{
Write-Output "System is x64. Need to update Linux kernel..."
if (-not (Test-Path wsl_update_x64.msi))
{
Write-Output "Downloading Linux kernel update package..."
Invoke-WebRequest -OutFile wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
}
Write-Output "Installing Linux kernel update package..."
Start-Process msiexec.exe -Wait -ArgumentList '/I wsl_update_x64.msi /quiet'
Write-Output "Linux kernel update package installed."
if ([Environment]::Is64BitOperatingSystem) {
Write-Output "System is x64. Need to update Linux kernel..."
if (-not (Test-Path wsl_update_x64.msi)) {
Write-Output "Downloading Linux kernel update package..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
$ProgressPreference = 'Continue'
}
Write-Output "Installing Linux kernel update package..."
Start-Process msiexec.exe -Wait -ArgumentList '/I wsl_update_x64.msi /quiet'
Write-Output "Linux kernel update package installed."
}

Write-Output "WSL is enabled. Setting it to WSL2"
wsl --set-default-version 2
Write-Output "WSL is enabled. Setting it to WSL2"
wsl --set-default-version 2

if(Test-Path 'C:\Program Files\Docker\Docker\Docker Desktop.exe' -PathType Leaf){
$yn=Read-Host -Prompt 'It seems Docker is already installed in your system. Do you want to reinstall/repair it Y/N?'
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ){
installDoker
} else {
Write-Output 'Docker installation/repair canceled.'
Write-Output 'If docker was already correctly installed on your system you should be able to proceed with the next steps anyway'
}
} else {
Write-Output 'It seems that Docker is not installed on the system, the installation is starting'
if (Test-Path 'C:\Program Files\Docker\Docker\Docker Desktop.exe' -PathType Leaf) {
$yn = Read-Host -Prompt 'It seems Docker is already installed in your system. Do you want to reinstall/repair it Y/N?'
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ) {
installDoker
}

}
else {
Write-Output 'Docker installation/repair canceled.'
Write-Output 'If docker was already correctly installed on your system you should be able to proceed with the next steps anyway'
}
}
else {
Write-Output "WSL is disabled."
Write-Output "Enabling WSL2 feature now. You will then restart your machine and execute the install docker option of the script again to complete the docker installation"
Write-Output 'It seems that Docker is not installed on the system, the installation is starting'
installDoker
}

}
else {
Write-Output "WSL is disabled."
Write-Output "Enabling WSL2 feature now. You will then restart your machine and execute the install docker option of the script again to complete the docker installation"

& cmd /c 'dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart'
& cmd /c 'dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart'
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Start-Sleep 30
Write-Output "WSL is enabled now reboot the system and re-run the script to continue the docker installation."
}
& cmd /c 'dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart'
& cmd /c 'dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart'
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Start-Sleep 30
Write-Output "WSL is enabled now reboot the system and re-run the script to continue the docker installation."
}

0 comments on commit 8499c8f

Please sign in to comment.