Chocolatey Install Package Failing

余生颓废 提交于 2020-04-06 22:08:22

问题


For those who are familiar with creating Chocolatey packages, can someone offer help to why this one isn't working? It packs, but when I test (install only package), it won't work. Here is the chocolateyinstall.ps1 file:

$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
  unzipLocation = $toolsDir
  fileType      = 'EXE' #only one of these: exe, msi, msu
  #url           = $url
  #url64bit      = $url64
  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

  silentArgs    = '/S' # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
  validExitCodes= @(0)
}

Install-ChocolateyInstallPackage @packageArgs # https://chocolatey.org/docs/helpers-install-chocolatey-install-package

When I do choco pack and then run choco install arm_rvct, I get this output:

Installing the following packages:
arm_rvct
By installing you accept licenses for the packages.

arm_rvct v3.1
arm_rvct package files install completed. Performing other installation steps.
Installing ARM_RVCT...
Microsoft.PowerShell.Commands.WriteErrorException
Error: C3079E: armcc command with no effect
Error: C3065E: type of input file '/S' unknown
Microsoft.PowerShell.Commands.WriteErrorException
ERROR: Running ["C:\ProgramData\chocolatey\lib\arm_rvct\tools\armcc.exe" /S ] was not successful. Exit code was '1'. See log for possible error messages.
The install of arm_rvct was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\arm_rvct\tools\chocolateyinstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - arm_rvct (exited 1) - Error while running 'C:\ProgramData\chocolatey\lib\arm_rvct\tools\chocolateyinstall.ps1'.
 See log for details.

回答1:


It tells you exactly what the problem is in the error message:

Error: C3079E: armcc command with no effect
Error: C3065E: type of input file '/S' unknown

First, it looks like you might be commenting out, or at the very least, not providing required parameters for armcc.exe. Second, it looks like /S in the context of armcc.exe isn't for a silent install - it wants an input file which you are not currently providing as part of your silent args.


armcc.exe isn't an installer btw - if you don't have a proper installer for your toolchain, consider putting the toolchain in a zip archive, embedding that zip in your package, and then install with Install-ChocolateyZipPackage instead of Install-ChocolateyInstallPackage (the latter is for installing exe or msi installers).

This should automatically generate some shims for your executables and place them on the path. Note that since this looks like it's for the arm_rvct compiler, if that normally accepts pipeline input, Chocolatey shims actually do not support pipeline input, so keep that limitation with generated shims in mind.


It does look like there is an official installer for the ARM toolchain. However, the installation instructions in the release notes don't provide any silent install instructions. That said, this is a common problem with undocumented installers - but it doesn't mean that you can't perform a silent install either, with some effort on your side.

You can either try running setup.exe /S or the referenced ARM Compiler 6.13.msi with msiexec /i "ARM Compiler 6.13.msi" /qn. If neither of these work, you have the options of reaching out to the vendor to ask how silent installs work, or you can go the route of taking the installed files and packaging them into a zip. Note that installers, especially for devkits and toolchains, may register assemblies in Windows and this can get complicated to reverse engineer if a simple file install doesn't work.


In this case though, the vendor would be the best resource to understand how you are able to deploy this package throughout your organization.



来源:https://stackoverflow.com/questions/60302932/chocolatey-install-package-failing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!