UniGetUI icon indicating copy to clipboard operation
UniGetUI copied to clipboard

[FEATURE REQUEST] Custom update scripts

Open Chaython opened this issue 2 years ago • 12 comments

Please confirm these before moving forward

  • [X] I have searched for my feature proposal and not found a work-in-progress/duplicate/resolved/discarded issue.
  • [X] This proposal is a completely new feature. If you want to suggest an improvement or an enhancement, please use this template

Describe the new feature

Allow users to set a script, to update from, when an update is available. This would be useful for modified apps like "block the spot" and "better discord".

*User installs app *User adds custom update variables *Winget finds update for app "app" *User checks and selects "update selected packages" *Custom update script is ran

Describe how this new feature could help users.

It will stop functionality break, and make updating moded apps more convenient.

Chaython avatar Jul 19 '23 22:07 Chaython

This kind-of already exists via "custom command line argument", but it's not as simple as copy pasting the powershell script from block the spot's readme....

If there's an easy way to tell it to skip udpating from repo and instead running the script via the existing interface lmk.

So far it seems more convenient to run the powershell script on start up. Than it is to run it via winget.

Perhaps this is similar to https://github.com/marticliment/WingetUI/issues/1117

But I really just want to ignore, existing winget etc, and on 'update found' trigger powershell script

Chaython avatar Jul 19 '23 22:07 Chaython

So, you mean something like custom post-install scripts?

marticliment avatar Jul 29 '23 17:07 marticliment

Ya, I guess. For example block the spot just uses: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-Expression "& { $(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1') } -UninstallSpotifyStoreEdition -UpdateSpotify" I'd need to run this every time I update spotify. Or download the .dll and drop it in the spotify folder every time there's an update to spotify. Just a minor inconvenience. Same with better discord, a discord update often needs a reinstall of better discord.

Also would be convenient if you could right click apps in the installed list to go to the app folder. I assume the current logging could already see the output folder[s]? It also seems wingetui checks against the registry, which registry has the installed folder.

Chaython avatar Jul 31 '23 18:07 Chaython

Also would be convenient if you could right click apps in the installed list to go to the app folder. I assume the current logging could already see the output folder[s]? It also seems wingetui checks against the registry, which registry has the installed folder

This is not true. There is no viable way of getting the install location from WingetUI.

Regarding the feature, it could be done, i don't see why not

marticliment avatar Jul 31 '23 19:07 marticliment

This is not true. There is no viable way of getting the install location from WingetUI.

Well for example the %LocalAppData%\Programs\WingetUI\choco-cli\logs writes SOME install locations "2023-07-29 00:09:27,786 8424 [INFO ] - Software installed to 'C:\Program Files\Proton\VPN'" Also obviously the windows registry has install locations. Querying the choco log for software locations and caching the locations would be fairly simple

`$LogPath = "$env:LocalAppData\Programs\WingetUI\choco-cli\logs\chocolatey.log" $SearchString = "Software installed to " $OutputFile = "Software install location.log"

Get-ChildItem $LogPath -Filter .log | ForEach-Object { $Content = Get-Content $_.FullName $Matches = [regex]::Matches($Content, "$SearchString'([^'])'") foreach ($Match in $Matches) { $InstallLocation = $Match.Groups[1].Value Add-Content $OutputFile $InstallLocation } } `

Chaython avatar Jul 31 '23 21:07 Chaython

This is not true. There is no viable way of getting the install location from WingetUI.

Well for example the %LocalAppData%\Programs\WingetUI\choco-cli\logs writes SOME install locations "2023-07-29 00:09:27,786 8424 [INFO ] - Software installed to 'C:\Program Files\Proton\VPN'" Also obviously the windows registry has install locations. Querying the choco log for software locations and caching the locations would be fairly simple

`$LogPath = "$env:LocalAppData\Programs\WingetUI\choco-cli\logs\chocolatey.log" $SearchString = "Software installed to " $OutputFile = "Software install location.log"

Get-ChildItem $LogPath -Filter .log | ForEach-Object { $Content = Get-Content $.FullName $Matches = [regex]::Matches($Content, "$SearchString'([^']_)'") foreach ($Match in $Matches) { $InstallLocation = $Match.Groups[1].Value Add-Content $OutputFile $InstallLocation } } `

Ok, let's assume we get the paths of all the chocolatey packages. How do we get the winget ones? and the scoop ones? they don't use logs from where locations can be extracted...

marticliment avatar Aug 01 '23 08:08 marticliment

Ok, let's assume we get the paths of all the chocolatey packages. How do we get the winget ones? and the scoop ones? they don't use logs from where locations can be extracted...

Does scoop not put all packages in %userprofile%\scoop\apps ? So just parse the name of the scoop app from that dir?

Chaython avatar Aug 01 '23 09:08 Chaython

this seems to be an open issue for Winget tho https://github.com/microsoft/winget-cli/issues/2298

ppvnf avatar Aug 01 '23 09:08 ppvnf

this seems to be an open issue for Winget tho microsoft/winget-cli#2298

Seems relevant but exclusively pertaining to winget

Chaython avatar Aug 01 '23 09:08 Chaython

Get-WmiObject -Class Win32_Product | Select-Object Name, InstallLocation will also display install locations of a few apps

Chaython avatar Aug 01 '23 09:08 Chaython

Would really like post-install update scripts, or even just the ability to run a specific command after install to be able to call a batch file. For example "Git For Windows" adds a couple of stupid context menu entries on every update, and I have a batch script I have to run that removes the registry entries for it. Would be nice to have this automatic.

I see in #2160 someone requested the same thing but that was marked as a duplicate but it's really not, it's subtly different from this one which is for entire update scripts. Post-update scripts should be much easier to implement since it's totally separate from the installation process.

ThioJoe avatar Jun 06 '24 17:06 ThioJoe

For example "Git For Windows" adds a couple of stupid context menu entries on every update

I avoid this context menus by installing git with custom parameters like this winget install --no-upgrade --scope machine -h --accept-package-agreements --accept-source-agreements Git.Git --custom '"/COMPONENTS="icons,assoc,assoc_sh,,,,gitlfs,icons\quicklaunch" /o:SSHOption=ExternalOpenSSH"

soredake avatar Jun 07 '24 11:06 soredake