Tuesday 23 May 2017

ChocolateStore - offline Chocolatey packages for SDI_CHOCO (E2B)

If you use the SDI_CHOCO feature of Easy2Boot to install drivers, Windows updates and applications completely unattended, you will know that applications are installed using Chocolatey.

The SDI Snappy Driver Installer and the WSUSOffline updater are both offline utilities, however Chocolatey is an online utility. Every time it runs, it will download the latest version of an application from the internet and automatically install it onto the target system. This takes time depending on your internet download speeds and also means we may get a different version of the software now than we got last week.

I have utilised the ChocolateStore github software by BahKoo on github so that we can now add offline chocolatey packages to the SDI_Choco process.

By installing the apps offline using Chocolatey, we get faster installation and we will always get the same app versions (unless we manually update them). We can still remove the USB drive after Setup reboots.

Not quite completely offline...

Note that we still have to get Chocolatey itself installed on the target system. Although the apps do not require an internet connection, the installation of Chocolatey using the standard SDI_CHOC scripts does require an internet connection. However, I have made an offline package to install Chocolatey (see end of this bog post). This means that you can now choose from 100's of ready-made Chocolatey apps and install Chocolatey itself completely offline.

P.S. E2B v1.93 will have the required utilities and SDI_CHOCO support for choco offline installs. I have this working and I can now do a completely automated offline install with drivers, WSUS updates and any offline choco apps apps I want with no Ethernet cable attached.

Watch this space!

How to use ChocBox

1. Update to E2B v1.93a or later
See E2B web page for the latest instructions

The text below may have been superseded by the website page content now!

2. Install Chocolatey onto your Windows system by running Install_Chocolatey.cmd (see \_ISO\WINDOWS\INSTALLS folder)
3. Run the ChocBox.cmd file from the Desktop ChocBox folder and answer the questions.


Note that the EXACT name must be specified for the second screen
and it is Case Sensitive!
The chocolatey packages will be downloaded and converted so that they can be installed from the C:\DRIVERS\CHOCBOX folder.

Choc apps in our chocolate box!
Instructions are displayed at the end of the script (also see below).

You can run ChocBox.cmd multiple times to collect multiple packages into the same C:\DRIVERS\CHOCBOX folder.

To set up SDI_CHOCO and install the apps, we need these three steps:

1. Copy the converted packages to the E2B drive
2. Transfer applications from the E2B USB drive to the target hard disk during Windows Setup
3. Install the apps at the end of Setup - the apps must all be located at C:\DRIVERS\ChocBox.

1. First Stage - E2B Folder

The first step is simple, we need to copy the whole C:\DRIVERS\CHOCBOX folder to your E2B USB drive.

If you want to be able to install a large number of different apps, in different combinations to different systems, then I suggest you use a folder structure such as:

\_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX\FoxitReader      (contains *.nupkg + folder)
\_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX\GoogleChrome (contains *.nupkg + folder)
etc.

This means that you can edit your scripts to only copy and install the packages that you want.

If you just want the same group of applications for all your installs, you could just have a single chocbox folder containing all the packages, e.g.
\_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX (contains all *.nupkg + folders)

Or alternatively, just copy the chocbox folder to your CONFIG folder, e.g.
\_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX\CHOCBOX (contains *.nupkg + folder)
in this case, because the whole XXXXXX folder is copied to the C:\DRIVERS folder automatically, we will end up with a C:\DRIVERS\CHOCBOX folder on the target drive.

2. Second Stage - Copy from USB drive to target hard disk

Each configuration will have a main CONFIG file, e.g. the default one is
\_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd

You may have made other Configs (which I will call config XXXXXX), so you would edit the
\_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX.cmd file and add xcopy commands such as:
xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\chocbox\FoxitReader\*.* %SystemDrive%\DRIVERS\CHOCBOX\
xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\chocbox\GoogleChrome\*.* %SystemDrive%\DRIVERS\CHOCBOX\
etc. etc. for each app.

If you have all the packages in the APPS\CHOCBOX folder, then just use one line, e.g.
xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\chocbox\*.* %SystemDrive%\DRIVERS\CHOCBOX\
However the OfflineChoco.TAG file will do this for you.If you put the CHOCO folder in your CONFIGS\XXXXXX folder, then you don't need to add an xcopy line.


3. Third Stage - install the apps

The best place to install apps is at the last stage after the user account has been created.
Most apps will install to 'All Users', but just in case some only install to the current user account and to avoid bad Registry entries, it is best to put the install code into the MyStartup.cmd file for your configuration.

For instance, if you are using the XXXXXX config, you would copy \_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX\Sample_MyStartup.cmd to MyStartup.cmd and edit it to add the relevant lines such as:

:: ---- OFFLINE INSTALL OF CHOCO PACKAGES ----

:: Install any offline packages that were in USB:\_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder - each one must be named by name
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG start /wait %systemdrive%\DRIVERS\nircmd speak text "Installing Fox it reader, win merge, prod u key and notepad plus plus"
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG echo Installing Offline Choco packages...
:: Some packages require chocolatey-core.extension, so always install this first
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG cinst chocolatey-core.extension  -source C:\DRIVERS\CHOCBOX -y -r >> %log%
:: Now install choco packages - must use xxxxxx.install if they are .install packages
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG cinst FoxitReader        -source C:\DRIVERS\CHOCBOX -y -r >> %log%
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG cinst WinMerge           -source C:\DRIVERS\CHOCBOX -y -r >> %log%
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG cinst ProduKey.install        -source C:\DRIVERS\CHOCBOX -y -r >> %log%
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG cinst notepadplusplus.install -source C:\DRIVERS\CHOCBOX -y -r >> %log%
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG start /wait %systemdrive%\DRIVERS\nircmd speak text "off line install finished"
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG echo Finished Offline Choco packages


Note that because the ChocBox.cmd script used C:\DRIVERS\chocbox as the target folder when the packages are made, the packages MUST be located at C:\DRIVERS\chocbox when they are installed.

Install Chocolatey completely offline

The OfflineChoco.TAG file will cause Choco to be installed if you use E2B v1.93 or later.

You will need to create an offline package for chocolatey and then add the chocolatey package + script to your Configuration. See www.easy2boot.com/add-payload-files/windows-install-isos/sdi-choco/chocbox/ for details.

A package to install choco without internet access can be found in the Alternate Download Area (InstallChocoOffline.zip) or use ChocBox to download the latest version.

If no internet access is required, use the NoInternet.tag file to prevent SDI_CHOCO from trying to establish internet connectivity. The NoInternet.tag file prevents SDI_CHOCO from stopping if there is no internet access available.

No comments:

Post a Comment