Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PreInstall / PostInstall commands #1279

Closed
Trenly opened this issue Jul 14, 2021 · 7 comments
Closed

PreInstall / PostInstall commands #1279

Trenly opened this issue Jul 14, 2021 · 7 comments
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@Trenly
Copy link
Contributor

Trenly commented Jul 14, 2021

Description of the new feature/enhancement

As mentioned in #1278 some installers have error codes for specific circumstances. Having the ability to execute one or two commands could make the users experience more seamless. Additionally, some packages such as f.lux which do not provide a version number could be modified with the command as a temporary workaround for poor development.

Proposed technical implementation details (optional)

The Windows Package Manager would have an enumeration of commands to be run before or after the installation or upgrade of a package. These could be enabled by default through a configuration option or with switches. If not specifically enabled, or not required for a package, the CLI could confirm with the user or default to not running the commands.

Example of switches:

winget install package -extended # Runs the PreInstall and PostInstall commands
winget install package -native # Does not run the PreInstall and PostInstall commands

Example of manifest

Installers:
  - InstallerType: exe
    InstallerArchitecture: x64
    InstallerSHA256: 12341234123412341234123412341234123412341234
    InstallerURL: https://www.contoso.com/awesomeapp/1.0.0/awesomeapp.x64.exe
    Commands:
      - RunOn: [Install, Upgrade, Always]
        Run: [Before, After]
        Command: "taskkill /f /im awesomeapp.exe"
        Description: "This command ensures that Awesome App is not running before the installation"
        Required: true

Precautions would have to be taken in the Azure Pipelines for winget-pkgs to ensure that no malicious code is executed.

@Trenly Trenly added the Issue-Feature This is a feature request for the Windows Package Manager client. label Jul 14, 2021
@ghost ghost added the Needs-Triage Issue need to be triaged label Jul 14, 2021
@denelon denelon removed the Needs-Triage Issue need to be triaged label Jul 14, 2021
@denelon
Copy link
Contributor

denelon commented Jul 14, 2021

One of our goals has been to avoid running commands or other arbitrary code, but there might be a reasonable subset of behaviors that could be considered. I'm putting this in the backlog for future consideration.

@Trenly
Copy link
Contributor Author

Trenly commented Jul 15, 2021

One of our goals has been to avoid running commands or other arbitrary code, but there might be a reasonable subset of behaviors that could be considered. I'm putting this in the backlog for future consideration.

Thanks for the consideration. I'll provide a few use cases, and will update this comment with more as I come across them

  • Something like Add Cobian Backup 11.2.0.582 + txt file for unattended install winget-pkgs#3810 could be resolved by using curl to get the text file and piping the output to the proper location.
  • Gyazo 4.2.0.0 doesn't add version information into the ARP entry. A single reg add command would be enough to fix this. (Admittedly, this is something the developer should fix, but it is technically possible to fix with this command)
  • OBSProject.OBSStudio will not install while the application is running. A single taskkill command would be enough to ensure that it upgrades smoothly

@denelon
Copy link
Contributor

denelon commented Jul 15, 2021

We've got another bit of work planned to help with package like OBS Studio #1278. A user would be sad if they were hours into encoding a video and absentmindedly ran winget upgrade --all and we just killed the process.

@Trenly
Copy link
Contributor Author

Trenly commented Jul 15, 2021

We've got another bit of work planned to help with package like OBS Studio #1278. A user would be sad if they were hours into encoding a video and absentmindedly ran winget upgrade --all and we just killed the process.

That is a very good point. I'm sure that there are positives and negatives to any use case

@denelon
Copy link
Contributor

denelon commented Jul 15, 2021

Yes, and we're looking to provide the best user experience we can. Many of the things we are building now are driven by legacy installers. While it would be nice to have every installer modernized, that's not practical in the short term. We are trying to meet developers where they are. As more users adopt the Windows Package Manager, we're hoping to make it easier to install software on Windows 10 and Windows 11. As publishers become more familiar with the tool, and hopefully reach new customers, they will likely start making the improvements necessary to give their customers the best experience as well.

@AlanMasciangelo
Copy link

@denelon Was this feature ever added?

Our organization is looking at migrating from Scoop to winget for developer environment setup. This type of behavior can be very useful for configuring the installed software based on organization preferences. For example adding company certificates, corporate proxy settings, or installing common extensions. I suppose the alternative would be wrapping that functionality in its own Windows installer.

@Trenly
Copy link
Contributor Author

Trenly commented Feb 13, 2024

No, this was not added @AlanMasciangelo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

3 participants