This method utilises the free utility NuGet Package Explorer to wrap existing software packages for bootstrapping with Cloud provisioning. These examples use a custom launcher (available on this site) to standatdise install and uninstall interfaces for software packages. Once packaged, the Chocolatey installers can be installed from a NuGet server using standard PowerShell cmdlines
Package Metadata
Starting with a new package – first customise the package metadata (notepad symbol on the left).
Make sure the tag "admin" is included with the package metadata.
Default / Example Install & Uninstall files
The text below represents basic install and uninstall files that will run a file called launcher4.exe from within the tools folder.
chocolateyInstall.ps1
[[csharp]] $fileLocation = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\tools\launcher4.exe" $packageArgs = @{ packageName = 'VisualC2010_10.00_86a' fileType = 'exe' file = $fileLocation validExitCodes= @(0, 3010) } Install-ChocolateyInstallPackage @packageArgs [[/csharp]]
----------------------------------------------------------------
chocolateyuninstall.ps1
[[csharp]] $fileLocation = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\tools\launcher4.exe" $packageArgs = @{ packageName = 'VisualC2010_10.00_86a' fileType = 'exe' SilentArgs = '/REMOVE' file = $fileLocation validExitCodes= @(0, 3010) } Uninstall-ChocolateyPackage @packageArgs [[/csharp]]
Adding Files to a Package
All packages must have a Tools folder along with the install and uninstall files as outlined above.
Right-Click in the white space to add the tools folder and each individual PowerShell file
Once the PowerShell contents have been saved – return to the main window.
As a last action, drag and drop the contents of the installer into the tools folder. This is what will be referenced by the install and uninstall scripts.
The package can now be saved and uploaded to a NuGet server.
- Log in to post comments