admin管理员组

文章数量:1392086

I am having an issue creating a Chocolatey package based on a Qt Installer Framework installer .exe (for which I want to use an installation script called silent_installer.js). The goal is to make the installer run silently. Manually invoking the installer with the Qt Javascript installation script at the command prompt does the job.

In my chocolateyInstall.ps1 script I am simply executing the following:

$packageArgs = @{
  packageName    = $env:ChocolateyPackageName
  softwareName   = 'Foo 64bit*'
  file           = $fileLocation
  fileType       = 'exe'
  silentArgs     = "--platform minimal --script $SilentInstaller InstallDir=$InstallationDestination"
  validExitCodes = @(0)
  checksum       = '2DACADCC70CC122054E60914CBC6B689F685BEF5713915A90F4185DD9DA7954E'
  checksumType   = 'SHA256'
  destination    = $toolsDir
}
Install-ChocolateyInstallPackage @packageArgs

I have verified that all arguments in packageArgs are set correctly. When I wait long enough, the installer .exe seems to have run successfully in the background, but the process "sticks around". Meanwhile, Install-ChocolateyInstallPackage appears to be hanging. When I pass -Verbose to it, I get no extra information. When I pass -Debug to it, Chocolatey keeps on asking me to Confirm that I wish to continue running the script in a loop (with one iteration every 30 seconds), even if I ran choco install with the -fy option.

Does anyone know what could be going on and how I could fix it?

Thank you in advance!

I am having an issue creating a Chocolatey package based on a Qt Installer Framework installer .exe (for which I want to use an installation script called silent_installer.js). The goal is to make the installer run silently. Manually invoking the installer with the Qt Javascript installation script at the command prompt does the job.

In my chocolateyInstall.ps1 script I am simply executing the following:

$packageArgs = @{
  packageName    = $env:ChocolateyPackageName
  softwareName   = 'Foo 64bit*'
  file           = $fileLocation
  fileType       = 'exe'
  silentArgs     = "--platform minimal --script $SilentInstaller InstallDir=$InstallationDestination"
  validExitCodes = @(0)
  checksum       = '2DACADCC70CC122054E60914CBC6B689F685BEF5713915A90F4185DD9DA7954E'
  checksumType   = 'SHA256'
  destination    = $toolsDir
}
Install-ChocolateyInstallPackage @packageArgs

I have verified that all arguments in packageArgs are set correctly. When I wait long enough, the installer .exe seems to have run successfully in the background, but the process "sticks around". Meanwhile, Install-ChocolateyInstallPackage appears to be hanging. When I pass -Verbose to it, I get no extra information. When I pass -Debug to it, Chocolatey keeps on asking me to Confirm that I wish to continue running the script in a loop (with one iteration every 30 seconds), even if I ran choco install with the -fy option.

Does anyone know what could be going on and how I could fix it?

Thank you in advance!

Share Improve this question asked Mar 11 at 16:23 Joshua SchroijenJoshua Schroijen 45410 silver badges27 bronze badges 3
  • Please post the entire file contents. You have $SilentInstaller, but it is not defined in what you posted. My guess is either you haven't defined it OR you have a bad path to the unpacked file. Similarly with $InstallationDestination. – ferventcoder Commented Mar 11 at 18:27
  • I explicitly mentioned that I have in fact checked that all these variables are filled in correctly at the time of invocation of this cmdlet – Joshua Schroijen Commented Mar 11 at 20:41
  • Set correctly - potentially. But if they are not absolute paths based on the location of the package, then it won't find the files. In other words, you couldn't just use .\\somefolder\somefile.json , and you shouldn't use a static absolute path. The $toolsDir usually gets set to the absolute path of the package in the lib folder, and you should use the same idea to navigate to the proper file under that package installation directory. It's easier to just ask that you include the whole script so it's verifiable that those values are set correctly, not just that they are set. – ferventcoder Commented Mar 12 at 21:50
Add a comment  | 

1 Answer 1

Reset to default 0

This is QT Installer, which has a reference at https://doc.qt.io/qtinstallerframework/ifw-cli.html.

One of those is -h or --help. I would suggest running that so you can determine the logging options and make sure you add that to the options. You can also pass that into the package with --install-arguments='VALUES' (https://docs.chocolatey./en-us/choco/commands/install/#options-and-switches), but it might be best to put it directly into the package until you determine what's working properly.

Right off, I can see you are missing install in your silent arguments, which is the command you need to run with a QT Installer, unless that is something that can be done in the script file. Likely, you'll need to do a check earlier in the chocolateyInstall.ps1 to determine if the software is already installed, then determine if you are running install or update as the command.

本文标签: