Romanitho / Winget-AutoUpdate

WAU daily updates apps as system and notify connected users. (Allowlist and Blocklist support)
MIT License
1.19k stars 141 forks source link

[Feature Request]: Make source parameters configurable to support private repositories #668

Open eclipse313 opened 2 months ago

eclipse313 commented 2 months ago

The request

I would like to make the source parameter configurable. Currently -s winget is always used as an argument so that private repositories are ignored.

But since I only want to use some packages from my private repository and some from the normal winget repository, changes are necessary in several places.

1st problem: How can I add my source?

I think we can simply use the _WAU-mods.ps1 file. There you can first check if the desired source is already registered and then register it. The necessary functions for this could be provided in _Mods-Functions.ps1.

Example for _WAU-mods.ps1:

if (!Exists-Source "nameofmysource") {
  Add-Source -n "nameofmysource" -a "https://example.org" -t "Microsoft.Rest"
}

2nd problem: Adjustment of the -s parameter

The -s parameter cannot simply be removed, as this could have undesired side-effects for existing installations, as currently only winget is searched for and not msstore.

I would suggest adding a registry entry WAU_DefaultSource. This can either be any value, then this value is passed to -s. If the key does not exist -s winget is passed to winget to maintain backward compatibility. If the value is *, the parameter -s is not passed at all in order to search all repositories (including a private one).

Summarized: WAU_DefaultSource does not exist → winget ... -s winget WAU_DefaultSource = abc → winget ... -s abc WAU_DefaultSource = winget → winget ... -s winget WAU_DefaultSource = * → winget ... (without -s)

3rd problem: Winget-Install.ps1

In order to distribute new WinGet apps in private repositories via Intune, the Winget-Install.ps1 must also be adapted.

An optional parameter $Source would be sufficient here (I think): [Parameter(Mandatory = $False)] [Switch] $Source.

I'm just not quite sure how to make sure that the source is already set up in winget.

Is this something that basically has a place in WAU or are there problems with it that I can't see right now.

I can just do a fork and try to implement some of the stuff, but my PowerShell skills are a bit rusty to be honest.

Therefore, before we or I do the work, I would first like to clarify whether this would be a welcome extension.

Thanks, Thomas

eclipse313 commented 2 months ago

Note: This topic was originally started in #559

eclipse313 commented 2 months ago

I have already tried to implement this for winget-install.ps1. You can check my attempts here: https://github.com/eclipse313/Winget-Install/commit/0e354224149fb01527940392be00cb13563ce27c

eclipse313 commented 2 months ago

Hi @Romanitho, Do you perhaps have time to take a look at it and give me your opinion? I can also try to continue my fork, I would just like to know if the concept fits with your ideas. Thanks :)

Romanitho commented 2 months ago

Hi, it looks good to me. Definitely something we can try to integrate to WAU.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

eclipse313 commented 1 month ago

Hi @Romanitho, this is still a very important feature for me. Especially with the MSI package, I see real potential there.

Is there anything I can do to help you or is my suggestion in the commit (https://github.com/eclipse313/Winget-Install/commit/0e354224149fb01527940392be00cb13563ce27c) enough?

Please let me know how I can support...

Romanitho commented 1 month ago

Apologies for the delay, but my top priority was to create that MSI to simplify everything. Now, after much work and testing, we are quite confident with this v2. We can now work on this type of feature with pleasure.

github-actions[bot] commented 1 week ago

This issue is stale because it has been open for 30 days with no activity.