Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.54k stars 43 forks source link

Create syncthingtray installer for windows #180

Closed soredake closed 6 months ago

soredake commented 1 year ago

Relevant components

Is your feature request specific to a certain platform/environment? Please specify. Windows 10/11.

Is your feature request related to a problem? Please describe. Right now syncthingtray does not have installer, which creates problems like this in chocolatey https://gitlab.com/yan12125/chocolatey-packages/-/issues/2

Describe the solution you'd like Have installer will make installation easy, and installer can also restart syncthingtray after updating (which choco package currently don't do)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Martchus commented 1 year ago

I don't plan working on this. Contributions are welcome of course (similar to how it has already been done for certain GNU/Linux distributions, see https://github.com/Martchus/syncthingtray#packages-and-binaries).


I have been pondering about implementing something different instead. One feature that has come to my mind is allowing the creation of a desktop icon and start menu entry via the wizard (besides the existing ability to configure the auto start). This would be a cross-platform feature. Under Windows it would also make sense to allow moving the binary to a default/custom application directory creating an entry in the Application Registration. This way the installer part would be cross-platform (as far as possible), the actual application could be the same binary and the installation would be neatly integrated with the general setup. Of course an uninstall button could also be added somewhere and the uninstall action for the Application Registration could also just trigger it (by invoking the main application via certain CLI args, similar to how the web UI can already be triggered).

I have also been considering adding an auto-update feature similar to what Syncthing itself provides. This would then of course also allow one to restart Syncthing Tray if wanted.

I haven't implemented any of this yet due to lack of time and motivation. However, that's how I would move this forward - instead of implementing a Windows-specific installer (possibly using some additional installer framework).

Note that I'd preferably implemented this within the qtutilities library so all my applications can benefit from this without extra effort (although code can of course be moved later as well).

Martchus commented 1 year ago

and installer can also restart syncthingtray after updating

For the restarting part I've just introduced the --replace argument. This could be used when making an installer.


When I find the time to implement an auto-update feature as mentioned in my previous comment I'm also going to make use of that mechanism.

yan12125 commented 1 year ago

How should I use the --replace option? From time to time, I got an error after syncthingtray-1.4.2-x86_64-w64-mingw32.exe --replace:

Unable to request Syncthing config: 連線被拒

The error message is "connection refused" in English I guess.

Martchus commented 1 year ago

I think there are multiple problems:

I can try to improve the 2nd point. I'm going to make another patch release very soon because I've noticed some annoying regressions. I'm not sure whether I can improve this already as part of this next patch release.

And to answer your question: Just appending --replace should be good enough.

yan12125 commented 1 year ago

If you still have an old version running that you want to replace it is not going to work

Thanks for the hint. I'm testing --replace when an existing 1.4.2 is running, so that may not be the issue.

For the chocolatey package, the replaced version is likely the older one, so I keep current package scripts. I will revisit --replace the next time.

some resources are still blocked by the old Syncthing instance

Yes this sounds like the cause. I'm using the built-in launcher, and I found the following messages in Settings -> Startup -> Syncthing launcher -> Syncthing log when the error occurs:

[INFO]    Loading config from: C:\Users\yen\AppData\Local\Syncthing\config.xml
[INFO]    Opening database from: C:\Users\yen\AppData\Local\Syncthing\index-v0.14.0.db
[INFO]    Using large-database tuning
[WARNING] Error opening database: The process cannot access the file because it is being used by another process. (is another instance of Syncthing running?)
Martchus commented 1 year ago

I've just created a new release but haven't taken care of this yet.

By the way, are you using the built-in library or an external application? I've only tested it with the built-in library so far (where I also sometimes ran into "Error opening database"). It always helped to simply start Syncthing again in the launcher settings. So the database lock seems to be released eventually and the 2nd instance is just too fast.

yan12125 commented 1 year ago

I'm using the built-in (bundled) syncthing, and I can confirm restart syncthing in settings works.

yan12125 commented 1 year ago

Maybe --replace is not what I need for the chocolatey package. During upgrades, I to need kill the running proces anyway, so that I can remove the old exe and install the new exe to the same path.

Martchus commented 1 year ago

I guess the installer/updater I'd implement at some point would simply move away the old executable while it is running (this should work even under Windows) and move the new executable where the old one was. It would then invoke the new executable with --replace and remove the old binary.

Maybe you needed a --quit option to close a possibly running instance. This would be very easy to implement but maybe you can just close the running process yourself (or tell the user to close it before continuing).

yan12125 commented 1 year ago

you can just close the running process yourself

Good point, I just implemented that in relevant chocolatey packaging scripts.

mckayc commented 1 year ago

Hey @yan12125 I just saw your comment from a few minutes ago. I am getting an error when trying to install with chocolatey.

ERROR: Checksum for 'C:\Users\~\AppData\Local\Temp\chocolatey\syncthingtray\1.4.3\syncthingtray-1.4.3-x86_64-w64-mingw32.exe.zip' did not meet 'e52b4a6dfb17ec21d901da60402c8df1b444680eb20603d716d9cd3af8b8135d' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary. The install of syncthingtray was NOT successful. Error while running 'C:\ProgramData\chocolatey\lib\syncthingtray\tools\chocolateyInstall.ps1'. See log for details.

Any ideas on why this is not working? It has not been working since yesterday. Thanks!

yan12125 commented 1 year ago

Probably something wrong during downloads. Anyway this is more likely a chocolatey issue than a syncthingtray one, so https://gitlab.com/yan12125/chocolatey-packages or https://community.chocolatey.org/packages/syncthingtray#discussion is a better place for further discussions.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

soredake commented 11 months ago

Not stale.

Neurrone commented 10 months ago

Am also experiencing the checksum errors when I tried installing it. The ftp download is also extremely slow

Martchus commented 10 months ago

What checksums are you talking about? I do not even provide downloads via FTP.

Neurrone commented 10 months ago

Ah sorry, after reading the above comments, I realize I should bring that in the chocolatey package repository.

It happens when I try installing this chocolatey package

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

soredake commented 8 months ago

Still interested.

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Tarek-Hasan commented 5 months ago

Is there any chance you guys could use Syncthing Windows Setup project to make a windows installer?

Martchus commented 5 months ago

I guess it would be best if that installer would include Syncthing Tray if that is wanted. Probably the creator/maintainer of that installer doesn't use Syncthing Tray, though.

I personally don't need/want the sophisticated setup this installer aims for so I wouldn't put any effort into utilizing that myself. In fact, I generally prefer the simple setup Syncthing Tray currently offers. As already stated in https://github.com/Martchus/syncthingtray/issues/180#issuecomment-1508361539 this is something other contributors are welcome provide, though.

Note that you can use Syncthing Tray together with the Syncthing itself installed via Syncthing Windows Setup, see https://github.com/Martchus/syncthingtray/blob/master/README.md#does-this-launch-or-bundle-syncthing-itself-what-about-my-existing-syncthing-installation.

G2G2G2G commented 3 weeks ago

Yea the installer would be nice literally just need to move the program to a different directory (like appdata) and then execute it as it already does. I see 90% of users leaving it in their downloads folder and then if they clear that out accidentally delete it lmao