From b2a4fb30721671005847867078cace62d7d01df7 Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Fri, 12 Jul 2024 07:25:48 +0100 Subject: [PATCH 1/2] (fix) Specifies Source for Microsoft Edge Install Offline installs that didn't have edge caught this issue, where an unspecified source meant it would try (and fail) to grab it from remote(s). --- Start-C4bNexusSetup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Start-C4bNexusSetup.ps1 b/Start-C4bNexusSetup.ps1 index 2db20c8..3736f5e 100644 --- a/Start-C4bNexusSetup.ps1 +++ b/Start-C4bNexusSetup.ps1 @@ -94,7 +94,7 @@ process { # Install a non-IE browser for browsing the Nexus web portal. if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) { Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site" - choco install microsoft-edge -y + choco install microsoft-edge -y --source ChocolateyInternal if ($LASTEXITCODE -eq 0) { if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') { $RegArgs = @{ From 2392565782cfb3e130882f365b29ec56761838f3 Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Fri, 19 Jul 2024 16:11:38 +0100 Subject: [PATCH 2/2] (doc) Upgrade Offline Install Steps --- OfflineInstallPreparation.ps1 | 21 ++++++++++++++++++++- README.md | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/OfflineInstallPreparation.ps1 b/OfflineInstallPreparation.ps1 index 83cca2c..10e71ff 100644 --- a/OfflineInstallPreparation.ps1 +++ b/OfflineInstallPreparation.ps1 @@ -33,7 +33,26 @@ param( } $true })] - [string]$LicensePath = "C:\ProgramData\chocolatey\license\chocolatey.license.xml", + [string]$LicensePath = $( + if (Test-Path $PSScriptRoot\files\chocolatey.license.xml) { + # Offline setup has been run, we should use that license. + Join-Path $PSScriptRoot "files\chocolatey.license.xml" + } elseif (Test-Path $env:ChocolateyInstall\license\chocolatey.license.xml) { + # Chocolatey is already installed, we can use that license. + Join-Path $env:ChocolateyInstall "license\chocolatey.license.xml" + } else { + # Prompt the user for the license. + $Wshell = New-Object -ComObject Wscript.Shell + $null = $Wshell.Popup('You will need to provide the license file location. Please select your Chocolatey License in the next file dialog.') + $null = [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") + $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog + $OpenFileDialog.initialDirectory = "$env:USERPROFILE\Downloads" + $OpenFileDialog.filter = 'All Files (*.*)| *.*' + $null = $OpenFileDialog.ShowDialog() + + $OpenFileDialog.filename + } + ), [string]$WorkingDirectory = $(Join-Path $env:Temp "choco-offline") ) diff --git a/README.md b/README.md index 4cb4370..b198779 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,14 @@ Below are the minimum requirements for setting up your C4B server via this guide > :warning:**DISCLAIMER**: This guide utilizes code from a GitHub repository, namely: [choco-quickstart-scripts](https://github.com/chocolatey/choco-quickstart-scripts). Though we explain what each script does in drop-down boxes, please do your due diligence to review this code and ensure it meets your Organizational requirements. > :memo:**Offline Install**: If your C4B server does not have unrestricted access to the internet, you can download the `choco-quickstart-scripts` repository to a Windows machine that is connected to the internet and run `OfflineInstallPreparation.ps1`. This will use Chocolatey to save all of the required assets into the repository folder, which can then be transferred to the target C4B server. +> - Download [choco-quickstart-scripts by clicking here](https://github.com/chocolatey/choco-quickstart-scripts/archive/refs/heads/main.zip). +> - Unzip it, e.g.: `Expand-Archive -Path ~\Downloads\choco-quickstart-scripts-main.zip -DestinationPath ~\Downloads\choco-quickstart-scripts`. +> - Run the OfflineInstallPreparation script, e.g.: `~\Downloads\choco-quickstart-scripts\choco-quickstart-scripts-main\OfflineInstallPreparation.ps1`. +> - Run the following to zip up your offline bundle: `Compress-Archive -Path ~\Downloads\choco-quickstart-scripts\choco-quickstart-scripts-main\* -DestinationPath ~\Downloads\C4B-Files.zip`. +> - Transfer the `C4B-Files.zip` from your downloads folder to your offline system. All further steps will be carried out on the offline system. +> - Run `Expand-Archive -Path \path\to\C4B-Files.zip -DestinationPath C:\choco-setup\files -Force` on your offline system. +> - Run `Set-Location "$env:SystemDrive\choco-setup\files"; Set-ExecutionPolicy Bypass Process; .\Start-C4bSetup.ps1` on your offline system. +> - Proceed to Step 2! ### Step 1: Begin C4B Setup