Starz0r / ChocolateyPackagingScripts

4 stars 1 forks source link

(LDtk) Co-maintainer to force machine install over user-install? #23

Open teknowledgist opened 2 months ago

teknowledgist commented 2 months ago

Hi.

The current LDtk installer is per-user which makes this package per-user and not a all-user/system install as is expected for the Chocolatey Community Repository. Unfortunately, this is a deficiency with the installer not offering that option and not something a "normal" Chocolatey package would resolve. I have opened an issue requesting that be fixed, but who knows how long until it is (if ever) fixed.

In the meantime, I have made a local ldtk Chocolatey package that approximates an all-user install. The one defect is that the .ldtk filetype extension will only be recognized for the installing user. I would make a PR, but all your package updates are based in Python with which I have no experience. My package updates are based around Chocolatey-AU.

I will need to maintain my local ldtk package for my own reasons anyway, so I would be happy to also maintain the community LDtk package, keep it updated (and return it to "normal" when the developer fixes the installer), and keep you on as a co-maintainer if you are willing. You can keep your name (and all the glory 😄 ), without any of the work.

Thanks!

Starz0r commented 2 months ago

The current LDtk installer is per-user which makes this package per-user and not a all-user/system install as is expected for the Chocolatey Community Repository.

I'm not really sure how many people use multi-user Windows, I try and offer the choice when it exists, but there's not much I can do if it's not already an option. I find it's hard to go out of my way for the possible low-percentage of users this would facilitate.

In the meantime, I have made a local ldtk Chocolatey package that approximates an all-user install. The one defect is that the .ldtk filetype extension will only be recognized for the installing user. I would make a PR, but all your package updates are based in Python with which I have no experience.

So you are saying you've found a way to localize it? Keep in mind the Python is used to manage the downloads, marshaling of metadata, and packing to the NuPKG format. If you're not changing any of that, and are doing this in the install script, you can always change that here and write a PR back. Otherwise you would need to describe what you've done, or take a look at the Python and change that.

Starz0r commented 2 months ago

So I got it backwards, you wanted to make the install per-machine rather than per-user. I'm still not sure how much worth the effort it would be since it sidesteps what the installer is already doing, but if you have a way you could always try to get it merged in.

My other recommendation still stands, if you can fit it in the PowerShell bootstrap installer then I'll take a look.

teknowledgist commented 2 months ago

The best solution would be for the developer to add the feature to the installer as I have requested int he referenced issue. If he does that, it would ideally be the default, but if it isn't either:

  1. You could add /ALLUSERS (possibly /ALLUSERS=1) to the silentargs which would meet Chocolatey packages best practices
  2. You could not change anything and any simple Chocolatey user needing it on a multi-user machine could use choco install ldtk --ia /ALLUSERS=1.

Until the installer is enhanced in that way, the only way to make it seem to be a machine-wide install is to "fake it".

  1. The chocolateyinstall.ps1 I created/tested uses the installer option /D=<path> and sets the path to the Chocolatey package folder (typically, C:\ProgramData\Chocolatey\lib\ldtk). All the install files end up there similar to most "portable" Chocolatey packages. The software appears to work just fine.
  2. A (all-user) Start Menu shortcut is created to make it easier for all users to find the software. I did not delete the start menu shortcut that is placed in the installing user's personal Start Menu because it is valid, but it would be easy to do so.
  3. Unfortunately, the uninstall registry entry (that Chocolatey typically references/uses) does not work with this installer when the /D=<path> switch is used, so I felt it is better to just remove the key entirely.

Because the binaries are within the package's folder, an uninstall removes the folder, but the chocolateyuninstall.ps1 script has to remove the all-user Start Menu shortcut. I also have it check for and remove the ldtk shortcut from the start menu of the uninstalling user, but if that is a different admin, the installing user will currently have an orphaned shortcut.

The small detail that I can't get past is the .ldtk filetype association. The installing user will have it set so files with the ldtk extension open in the software. Other users will not. As best as my skills are able, MS has made system-wide assignments impossible outside of an (proper, machine-wide) install program. Because the official uninstall is broken/removed, a Chocolatey uninstall does not remove that association, so even after the software is removed, .ldtk files are associated with the (now missing) software for the installing user.

So, if I were to create a PR against your repo for this, that is the rather messy bootstrap installer you would get -- at least until Deepnight enhances the installer.

I know: It's wacky.