Reputation: 81
I am going to have to create a bunch of local chocolatey packages, and I am still failing at creating my first one. To set this straight, do I need to be using the installer.exe
for packaging?
Here is an example of the chocolateyinstall.ps1
for my first package attempt where you can, I used armcc.exe
for the ARM RVCT installer I was trying to make.
$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'armcc.exe'
$packagename = 'ARM_RVCT'
$packageArgs = @{
packageName = $packagename
fileType = 'EXE' #only one of these: exe, msi, msu
file = $fileLocation
softwareName = 'ARM_RVCT*' #part or all of the Display Name as you see it in Programs and Features. It should be enough to be unique
validExitCodes= @(0, 3010, 1641)
silentArgs = '/VERYSILENT'
#silentArgs = '/s' # InstallShield
#silentArgs = '/s /v"/qn"' # InstallShield with MSI
#silentArgs = '/s' # Wise InstallMaster
#silentArgs = '-s' # Squirrel
#silentArgs = '-q' # Install4j
#silentArgs = '-s' # Ghost
# Note that some installers, in addition to the silentArgs above, may also need assistance of AHK to achieve silence.
#silentArgs = '' # none; make silent with input macro script like AutoHotKey (AHK)
}
Install-ChocolateyInstallPackage @packageArgs # https://chocolatey.org/docs/helpers-install-chocolatey-install-package
I have just being going off of the documentation I can find but really don't know what to look for. I know that my packages need to be locally sourced, but that is it. If I can create one successful package and actually understand it, I think I should be able to succeed with the rest.
Upvotes: 1
Views: 278
Reputation: 11364
There are a number of tutorials available that walks you through creating a NuGet package. Chocolatey installs nuget packages from local source or artifactory and uses a packaged nuget file. This nuget package contains nuspec file that contains meta, tools folder that normally contains any executables or your custom app or script and chocolatey install and uninstall scripts.
Choco new packageName
should get you going with a package with all files
Once done with modifying the data, choco pack <path/to/nuspec>
Without a nuget package, chocolatey installs wont work.
One source on how to create NuGet package
Google how to create nuget package and then test it locally.
Upvotes: 1