1
votes

I am working on making custom packages for chocolatey to install software that I find myself installing at random times. These are only for me and I do not plan on distributing them anywhere.

I am trying to make a custom package installer for a software that requires a product key and can't seem to find a way to put the product key in the chocolatey package installer.

Any help or resources to a place that describes how to do this would be greatly appreciated.

1
If you remove Chocolatey from the equation, how do you pass the license key when installing manually? Knowing the answer to this question will help to other your main question. - Gary Ewan Park

1 Answers

0
votes

The caveat is that you need to know where this license key goes when the product is installed. Once you have that information, you can add that to the PowerShell script to place that for you.

  • File-based: For instance, the key needs to be in an XML file - add the xml file to the packaging and copy it as part of the chocolateyInstall.ps1 script to the correct location on the machine
  • Registry: create the registry key as part of the chocolateyInstall.ps1 script.
  • Installer argument: pass that in the silentArgs in the package.

Now, that said, a great resource to look at is the Package Parameters walkthrough - https://chocolatey.org/docs/how-to-parse-package-parameters-argument. It has examples of how to do those things in PowerShell and shows how you can delay passing in those keys into the packages themselves so if you want to share the packages later with others, you don't have to worry about giving away your key. It's kind of a data separation pattern.