Skip to content

Commit 19bf837

Browse files
Merge pull request #254 from chocolatey/offlineChanges
Offline Updates
2 parents 01fb057 + 2392565 commit 19bf837

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

OfflineInstallPreparation.ps1

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,26 @@ param(
3333
}
3434
$true
3535
})]
36-
[string]$LicensePath = "C:\ProgramData\chocolatey\license\chocolatey.license.xml",
36+
[string]$LicensePath = $(
37+
if (Test-Path $PSScriptRoot\files\chocolatey.license.xml) {
38+
# Offline setup has been run, we should use that license.
39+
Join-Path $PSScriptRoot "files\chocolatey.license.xml"
40+
} elseif (Test-Path $env:ChocolateyInstall\license\chocolatey.license.xml) {
41+
# Chocolatey is already installed, we can use that license.
42+
Join-Path $env:ChocolateyInstall "license\chocolatey.license.xml"
43+
} else {
44+
# Prompt the user for the license.
45+
$Wshell = New-Object -ComObject Wscript.Shell
46+
$null = $Wshell.Popup('You will need to provide the license file location. Please select your Chocolatey License in the next file dialog.')
47+
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms")
48+
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
49+
$OpenFileDialog.initialDirectory = "$env:USERPROFILE\Downloads"
50+
$OpenFileDialog.filter = 'All Files (*.*)| *.*'
51+
$null = $OpenFileDialog.ShowDialog()
52+
53+
$OpenFileDialog.filename
54+
}
55+
),
3756

3857
[string]$WorkingDirectory = $(Join-Path $env:Temp "choco-offline")
3958
)

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ Below are the minimum requirements for setting up your C4B server via this guide
7171
> :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.
7272
7373
> :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.
74+
> - Download [choco-quickstart-scripts by clicking here](https://github.com/chocolatey/choco-quickstart-scripts/archive/refs/heads/main.zip).
75+
> - Unzip it, e.g.: `Expand-Archive -Path ~\Downloads\choco-quickstart-scripts-main.zip -DestinationPath ~\Downloads\choco-quickstart-scripts`.
76+
> - Run the OfflineInstallPreparation script, e.g.: `~\Downloads\choco-quickstart-scripts\choco-quickstart-scripts-main\OfflineInstallPreparation.ps1`.
77+
> - 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`.
78+
> - Transfer the `C4B-Files.zip` from your downloads folder to your offline system. All further steps will be carried out on the offline system.
79+
> - Run `Expand-Archive -Path \path\to\C4B-Files.zip -DestinationPath C:\choco-setup\files -Force` on your offline system.
80+
> - Run `Set-Location "$env:SystemDrive\choco-setup\files"; Set-ExecutionPolicy Bypass Process; .\Start-C4bSetup.ps1` on your offline system.
81+
> - Proceed to Step 2!
7482
7583
### Step 1: Begin C4B Setup
7684

Start-C4bNexusSetup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ process {
9494
# Install a non-IE browser for browsing the Nexus web portal.
9595
if (-not (Test-Path 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')) {
9696
Write-Host "Installing Microsoft Edge, to allow viewing the Nexus site"
97-
choco install microsoft-edge -y
97+
choco install microsoft-edge -y --source ChocolateyInternal
9898
if ($LASTEXITCODE -eq 0) {
9999
if (Test-Path 'HKLM:\SOFTWARE\Microsoft\Edge') {
100100
$RegArgs = @{

0 commit comments

Comments
 (0)