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

Create syncthingtray installer for windows #180

Closed
1 task done
soredake opened this issue Apr 14, 2023 · 23 comments
Closed
1 task done

Create syncthingtray installer for windows #180

soredake opened this issue Apr 14, 2023 · 23 comments

Comments

@soredake
Copy link

Relevant components

  • Standalone tray application (based on Qt Widgets)

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
Copy link
Owner

Martchus commented Apr 14, 2023

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
Copy link
Owner

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
Copy link
Contributor

yan12125 commented Jun 8, 2023

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
Copy link
Owner

Martchus commented Jun 8, 2023

I think there are multiple problems:

  • If you still have an old version running that you want to replace it is not going to work. The version to be replaced needs to be at least 1.4.2. This means it will only be really useful on the next release (or even later if users skip versions).
  • When using the built-in launcher Syncthing itself well be stopped and started as well. This is expected and makes sense. However, it seems that some resources are still blocked by the old Syncthing instance when the new one already tries to start leading to a startup failure. That in turn leads to "connection refused" because the new Syncthing instance could not be started successfully.

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
Copy link
Contributor

yan12125 commented Jun 8, 2023

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
Copy link
Owner

Martchus commented Jun 8, 2023

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
Copy link
Contributor

yan12125 commented Jun 9, 2023

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

Martchus added a commit that referenced this issue Jun 9, 2023
So `Launcher::terminate()` exits when really everything has terminated and
not just sub processes. It may nevertheless be worthwhile to implement a
timeout.

This may help with
#180 (comment).
@yan12125
Copy link
Contributor

yan12125 commented Jun 9, 2023

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
Copy link
Owner

Martchus commented Jun 9, 2023

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
Copy link
Contributor

you can just close the running process yourself

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

@mckayc
Copy link

mckayc commented Jun 11, 2023

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
Copy link
Contributor

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
Copy link

stale bot commented Aug 10, 2023

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.

@stale stale bot added the stale label Aug 10, 2023
@soredake
Copy link
Author

Not stale.

@stale stale bot removed the stale label Aug 10, 2023
@Neurrone
Copy link

Neurrone commented Oct 1, 2023

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

@Martchus
Copy link
Owner

Martchus commented Oct 1, 2023

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

@Neurrone
Copy link

Neurrone commented Oct 1, 2023

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

Copy link

stale bot commented Nov 30, 2023

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.

@stale stale bot added the stale label Nov 30, 2023
@soredake
Copy link
Author

soredake commented Dec 1, 2023

Still interested.

@stale stale bot removed the stale label Dec 1, 2023
Copy link

stale bot commented Jan 30, 2024

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.

@stale stale bot added the stale label Jan 30, 2024
@soredake soredake closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
@Tarek-Hasan
Copy link

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

@Martchus
Copy link
Owner

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 #180 (comment) 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.

@Martchus Martchus removed the stale label Feb 14, 2024
@G2G2G2G
Copy link

G2G2G2G commented Jul 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants