Lazarus

Announcements => Third party => Topic started by: minesadorada on August 09, 2014, 06:13:36 pm

Title: Laz AutoUpdate component - beta
Post by: minesadorada on August 09, 2014, 06:13:36 pm
Beta version is ready for testing.  The installer deploys an example application which uses the Laz AutoUpdate component.

Download from here: SourceForge project site (https://sourceforge.net/projects/lazautoupdate/)

Summary and Blurb
LazAutoUpdate is a drop-in component for developers who host their applications on SourceForge.   It makes updating your application with newer versions a simple and painless process for both the developer and the end user.

License
LGPLv2

Source Code
Available via the SourceForge project site (SVN) Linky (https://sourceforge.net/p/lazautoupdate/code/HEAD/tarball)

Dev Environment
Windows 32-bit tested.  Should be OK on x64
Lazarus 1.2.4  FPC 2.6.2

Status
Beta

Expected behaviour
The example application installs into the [Program Files] folder.
There are two buttons to click:
[Check for newer version]
[Check, Download and Install]

The app should be reporting version 0.0.2 at start up.  (Newer version 0.0.6 is available)

Initial feedback appreciated on this thread..

More info in the Wiki (http://wiki.freepascal.org/LazAutoUpdater)
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 11, 2014, 02:53:30 pm
Updates itself to v.0.0.3 now
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: JuhaManninen on August 11, 2014, 04:59:34 pm
Is there a plan to make it cross-platform?
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 11, 2014, 07:14:35 pm
Yes, absolutely.

First, I need to see if the concept is sound, and Windows offers the easiest platform for me to test.

Besides, I have yet to get a linux lazarus dev platform running on my machine (long story), but there is nothing windows-specific in the source.

I'm just looking for some feedback before I invest too much time into it.
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: truetom on August 12, 2014, 05:17:18 am
Hello,

Can not find aboutlazautoupdateunit.pas , Please check it.

Best regards and thanks!
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 12, 2014, 09:33:13 am
Sorry - added a unit to the package last night, and went down to the bar with friends having forgotten to commit it to SVN  :-\

All fixed now.

Anyone having trouble with windows permissions and the installer?  You have to be an admin to install anything to [Program Files] in Vista at least.
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: freeman35 on August 14, 2014, 06:29:23 pm
A few days ago I finished my update program, its not component. I have some suggestions.
Code: [Select]
[App detail]
app name=Program extra info
version=6.0.1.3499
date=2014.08.11
compressed=1
url=http://www.xxx.xom/update/prj/ver/app.zip
size=4852465 --> I used lnet http, I can not get file size, this is for gauages

[files]
count=1 --> maybe dll or other files can be need upgrade

[file1]
url=
version=0.0.0.0
descrip=
compressed=0  --> maybe no need compress, small ini files etc.
filesize=0
I used lnet, for ftp protocol, need username and password. http and port:80 is easy way my idea
if I were you, for "NewVersionAvailable" control, add OnVersionCheck TNotify event. so programer can change version check rule. Examp: Just Update if "0.0.x.0" x is greater NewVersionAvailable := True;
regards
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 14, 2014, 08:19:46 pm
...

if I were you, for "NewVersionAvailable" control, add OnVersionCheck TNotify event. so programer can change version check rule. Examp: Just Update if "0.0.x.0" x is greater NewVersionAvailable := True;
regards
Good Idea.  I'll try to implement something similar.

Did LazAutoUpdate work for you?
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: freeman35 on August 15, 2014, 10:16:17 am
Quote
Did LazAutoUpdate work for you?
No, 'cos I'm on kubuntu 14.04 x64
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 15, 2014, 12:09:52 pm
Added events (as suggested)

OnDownloaded(Sender: TObject;ResultCode, BytesDownloaded: Integer)
OnNewVersionAvailable(Sender: TObject;Newer: Boolean; OnlineVersion: String);
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 16, 2014, 12:31:09 pm
The updater has now been itself updated, so re-install before testing.
V0.0.5 has many stability improvements.  Installer will report 0.0.2 with update to 0.0.5 available.
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 18, 2014, 02:35:17 pm
Linux version is functional but threading/GUI responsiveness is still a bit shaky.
Title: Re: (New) Laz AutoUpdate component - looking for testers
Post by: minesadorada on August 19, 2014, 11:18:53 am
The updater can now cope with an update zip containing a whole tree of update files/folders.

Now at V0.0.6

Download new installer, then Update to get the latest functionality
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 06, 2014, 12:14:10 pm
V0.0.8

Linux demo available for download

https://sourceforge.net/projects/lazautoupdate/
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 18, 2014, 08:45:49 pm
Introducing LazAutoUpdate Pack..

https://sourceforge.net/projects/lazautoupdate/

http://wiki.freepascal.org/LazAutoUpdater

A GUI that makes managing multiple SourceForge project updates a snap.

I am a believer in making difficult things easy via code (because I'm a typical lazy programmer) and the Update Pack enables a developer to easily maintain application updates and improvements.

Only Windows32 ATM but Linux will be available when I reboot into Mint and compile/upload

Enjoy and criticize (why else would I post in a forum full of talented programmers?) :)
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 19, 2014, 05:10:57 pm
Linux 64-bit edition of Update Pack now available from SourceForge

https://sourceforge.net/projects/lazautoupdate/
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 21, 2014, 02:22:50 pm
Win32: UpdatePack to version 0.0.7  LazAutoUpdate to v0.1.5  (Linux edition to follow ASAP)

Quite a few improvements to the UpdatePack (I use UpdatePack to manage the updates to UpdatePack itself of course)  If you have already downloaded it, in the Help Menu, click 'check for updates' to get the latest version.

You can now drag any extra files you want to add/replace/update in the application's directory.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 21, 2014, 06:34:43 pm
Linux 64-bit edition of Update Pack v0.0.7.1 now available via Help Menu 'check for updates'

I love Lazaus multiplatform - the Win32 code changes just compiled clean in 64-bit linux :)  As soon as I can figure out how to get target=i386 working in my Mint 64-bit distro I'll compile and upload the Linux 32-bit editions.

I won't post any more update notices here.  Just click Help/Check for updates every so often - after all, that's the purpose of LazAutoUpdate..

Next AutoUpdate add-on will be a systray app that can automatically check for updates of any LazAutoUpdate-enabled app that you put in a list.  Designed to run at OS startup.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on September 28, 2014, 02:01:25 pm
For those following progress of the LazAutoUpdate suite, there is now a Blog of progress etc.

https://sourceforge.net/p/lazautoupdate/lazautoupdateblog/
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 08, 2016, 01:30:11 am
I've got your component installed and I love the idea, just want I was looking for. I have one small question concerning its usage. Where does the component read the application versioning info from to compare against the versions.ini file?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 08, 2016, 03:19:34 am
I've got your component installed and I love the idea, just want I was looking for. I have one small question concerning its usage. Where does the component read the application versioning info from to compare against the versions.ini file?
When dropped into an application, it should read the Version info (set in Project/Options/Version Info)
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 08, 2016, 04:05:43 am
Ok, that's what I thought.  In the Project Settings are Major Version, Minor Version, Revision and Build. The Build can go to 65535.  In your Updatepack, you have 4 positions as well, but the 4th can only go to 99.

If my Project settings are 0.5.1.3930 is that what I put into the version.ini?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 08, 2016, 09:12:25 am
In the current version that will probably be ok.  It actually converts the quad into a single integer (0x10000+5x1000+1x100+3930=9030) which doesn't allow for high version numbers.  Yours is a low version number with a high build number so it should cope.

I plan to revisit the LazAutoUpdate project soon to refactor the versioning system into a proper Quad record and also update other code, as Sourceforge have changed their download protocols recently.  It also need to work properly for Unix ELF files and Mac MACH-O files.

I've just done a quick code review, and discovered the Sourceforge downloads no longer work properly.  I'll be addressing this issue in an update.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 09, 2016, 03:22:31 pm
So, in essence, until you release an update, LazAutoUpdate no longer works because of a change in Sourceforge. Just curious, do you have an idea as to when you might have your update ready?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 09, 2016, 03:30:55 pm
So, in essence, until you release an update, LazAutoUpdate no longer works because of a change in Sourceforge. Just curious, do you have an idea as to when you might have your update ready?
I'm hoping by next week. It's quite a substantial refactor.  Ironically I'm currently working in a GUI to configure updating packages.
Sourceforge now redirects (as before) but now redirects again using a js on the server.  Current code can't cope.  Good news - I've already refactored the version code.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on December 09, 2016, 03:48:54 pm
Hi, this can work with GitHub too? In GitHub downloads don't have the redirect problem, but the code you use to download must have a proper User-Agent like

Quote
client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');

and it must support https downloads, so maybe need to include the extra dll's (OpenSSL ssleay32.dll and libeay32.dll), depending on what you're using for the download.

The downloads are stored like this:

https://github.com/newpascal/lazarus/releases/download/lazarus4np-v1.0.37/lazarus.zip

so github prefix, organization or username, project, releases, download, tag, filename

in each release the thing that changes is the tag, and maybe the filename,
of course you can delete the previous file and replace with another with the same name, so the url will not change

but if for example is needed to store text in a url that donesn't change maybe can be used the master repository

for example, in bgracontrols I have the external json like this
https://raw.githubusercontent.com/bgrabitmap/bgracontrols/master/update_bgracontrols_force.json

so any file can be downloaded as text with no problems, for the version.ini that's online
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 09, 2016, 04:29:24 pm
Looking forward to the update!
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 09, 2016, 05:20:01 pm
It's just the downloading part that needs fixing.  The underlying updating code logic checks out OK, but the Synapse code I use is a bit hacky and primitive.

I know downloading text and binaries from SourceForge can be done, because GetMem's OnlinePackageManager does it, so I'll start by looking at how.  It needs to be threaded, and I think OPM does that.  I prefer to learn from an expert than struggle to reinvent code.

Once SourceForge functionality is sorted, I'll take a look at GitHub.  How hard can it be? :)
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 18, 2016, 03:33:13 pm
Has this been fixed yet so that it is usable?  I really want to include the ability to look for an update in my project and I don't want to reinvent the wheel.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 18, 2016, 05:40:49 pm
Has this been fixed yet so that it is usable?  I really want to include the ability to look for an update in my project and I don't want to reinvent the wheel.
Like a lot of people with families, I expect to be away from the coding keyboard over Christmas/New Year.
It is on my to-do list, but not a quick fix.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on December 18, 2016, 05:50:55 pm
Has this been fixed yet so that it is usable?  I really want to include the ability to look for an update in my project and I don't want to reinvent the wheel.

I like this tool, but I maybe will use other way for my application, and I already tested it, is Windows only, since most of my applications are for Windows only.

1) Create an installer for your application, better with Inno Setup
2) Upload it somewhere
3) Create a JSON with the version information and the download url
4) Load the JSON with your application, if there's a new version, prompt the user to download it. If yes download and install the application, maybe with /silent or /verysilent mode. Of course you need to close your application first to ensure the exe is replaced correctly.

This always works. This is something like Notepad++ does.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 18, 2016, 08:47:05 pm
However, I need a cross-platform solution as my project it targeted at Unix/Win32 platforms so that wouldn't work for me.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on December 18, 2016, 09:50:46 pm
I see.

In your case will be the same steps for windows, and for unix instead of making a setup making a deb, and running the command line to install it or open with the default application.

If your program is portable, don't have a deb, then you must wait for this component, or modify it to download from other places instead of sourceforge.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 18, 2016, 09:54:15 pm
I appreciate your input on this and I will wait for the author to update the component.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on December 19, 2016, 11:05:34 am
I've made a tentative start. HTTPClient will replace synapse, and it will need SSL support with SourceForge & GitHub.  Looks very do-able but might take awhile depending on available coding time.  I need LazAutoUpdate to work again for some of my own apps, so there's an incentive.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on December 19, 2016, 03:35:45 pm
That's wonderful news!!
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 08, 2017, 01:15:17 pm
Just curious, how are we looking on getting LazAutoUpdate working again?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 08, 2017, 02:07:50 pm
I've been distracted writing a Foobot interface.  LazAutoUpdate is next on my list.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 13, 2017, 04:41:17 pm
Just curious, how are we looking on getting LazAutoUpdate working again?
I've started this and so far results are encouraging.  Sourceforge downloads are working fine, and the code is a lot cleaner.
Lazautoupdate isn't just the component however, and there is lots of refactoring to do with the other parts yet.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 13, 2017, 05:22:29 pm
Looking forward to the release.   :)
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 13, 2017, 06:12:34 pm
It works fine in Linux, but Windows 10 permissions are defeating it unless the app is run 'as administrator' (when it works fine)

The stumbling block is AsyncProcess starting an external console app (updatehm) in Windows 10.  After a little web research, I can't see a way round this yet.

==Edit== Sorted. I have to use ShellExecuteEx with the 'runas' verb in the Windows 10 case.

Onwards and upwards!
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 14, 2017, 09:18:10 am
LazAutoUpdate component update to V0.2.0.0

* Rewrite of core updating code
* Available via OnlinePackageManager
  * Be sure to click 'Update' so that you get V0.2.0.0.
  * V0.1.27 is now deprecated.
* Read the 'readme_developer.txt' in /testapp before using
* Win32/64 and Linux32/64 only.

This is a work-in-progress, and needs testing thoroughly before deploying in a production environment.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 14, 2017, 09:50:08 am
Hi minesadorada,

I attempted to add v0.2.0.0 as default to the main repository, but with Lazarus Trunk/FPC 3.0.0 it won't compile. It's the same issue we discussed before:
Basically you have to move(unit versionsuport.pas) LCLVersion to the interface uses, then add {$IF (lcl_major > 0) and (lcl_minor > 6)} LCLPlatformDef {$ENDIF}; to the implementation uses. You can also test with other combination Laz 1.6/1.6.2 but it should work.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 14, 2017, 10:00:14 am
Hi minesadorada,

I attempted to add v0.2.0.0 as default to the main repository, but with Lazarus Trunk/FPC 3.0.0 it won't compile. It's the same issue we discussed before:
Basically you have to move(unit versionsuport.pas) LCLVersion to the interface uses, then add {$IF (lcl_major > 0) and (lcl_minor > 6)} LCLPlatformDef {$ENDIF}; to the implementation uses. You can also test with other combination Laz 1.6/1.6.2 but it should work.
OK Will do.  I'd assumed that OPM would only been used/seen by Laz 1.8/fpc3.11+ users.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 14, 2017, 10:24:30 am
Hi minesadorada,

I attempted to add v0.2.0.0 as default to the main repository, but with Lazarus Trunk/FPC 3.0.0 it won't compile. It's the same issue we discussed before:
Basically you have to move(unit versionsuport.pas) LCLVersion to the interface uses, then add {$IF (lcl_major > 0) and (lcl_minor > 6)} LCLPlatformDef {$ENDIF}; to the implementation uses. You can also test with other combination Laz 1.6/1.6.2 but it should work.
Recompiled to V0.2.1.0.
Compiles in Trunk/trunk and Laz1.6.2/fpc3.0.0

Please test
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 14, 2017, 10:49:05 am
I think you uploaded the wrong zip. I'm downloading from here: https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip . The package version is 0.2.1.0, but unit versionsuport.pas is the same. Still does not compile with lazarus trunk.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 14, 2017, 11:05:16 am
I think you uploaded the wrong zip. I'm downloading from here: https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip (https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip) . The package version is 0.2.1.0, but unit versionsuport.pas is the same. Still does not compile with lazarus trunk.
Very strange.  I just unzipped lazautoupdate.zip into a new folder, opened Laz1.62/fpc3.0.0 and loaded lazupdate.lpk and clicked 'Compile'.  No errors (see screenshot)

And then with Laz1.7/fpc3.1.1.  No errors (see screenshot)  My copy of 'trunk is Rev:53588M - maybe changes since then?

The Zip is under SVN control, so no versioning issues I think.
What compilation errors are you seeing?
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 14, 2017, 11:14:55 am
Quote
And then with Laz1.7/fpc3.1.1.  No errors (see screenshot)  My copy of 'trunk is Rev:53588M - maybe changes since then?
Yes. LCLPlatformDef was added in Lazarus revision 53711(Dec 8. 2016).
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 14, 2017, 11:34:59 am
It works here both with 1.6 and trunk. I modified the 0.2.1.0 package. Please test:
http://packages.lazarus-ide.org/test/lazautoupdate.zip

PS: By trunk I mean r. 53941, with r. 53588 won't work.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 14, 2017, 11:53:52 am
OK. All updated now.  I put in a ForceNotify, but that will be removed on the next Version change.
I'll have to update my copy of Trunk and see the new stuff.  I don't do it often because of the faff of rebuilding the cross-compilers.

Thanks for your help.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 14, 2017, 11:58:03 am
Quote
OK. All updated now.  I put in a ForceNotify, but that will be removed on the next Version change.
No need for ForceNotify. I will add 0.2.1.0 directly to the main repository. It will be the latest version.

Quote
I'll have to update my copy of Trunk and see the new stuff.  I don't do it often because of the faff of rebuilding the cross-compilers.
Yes, this is understandable.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 01:55:10 pm
LazAutoUpdate Updated to V0.2.2.0

* Support for GitHub added
* You can now host your updates using your GitHub account and have your app update itself.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 02:14:38 pm
Many thanks for taking into consideration the GitHub support, I will try it. Is also available in the Online Package Manager right?

Everything is included, also the editor for the zip?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 02:35:23 pm
Hi Lainz,
V0.2.2.0 is in OPM.
I haven't done the documentation yet, but I'd be grateful if you tested it (I don't use GitHub)
Please follow ALL the steps below:

1. Upload your newer version of the app along with a 'whatsnew.txt' textfile  (together in a zipfile) to a subfolder of 'master'.  The whatsnew.txt file has to be in the zip, and the filename has to be 'whatsnew.txt' else the update won't work.
2. Upload a versionsini file (<name it the same as the app>.ini) in the same location with the format:
; LazAutoUpdate versions file
[versions]
GUI=0.1.0.0

..where the GUI entry is the same as your uploaded app and higher than the app versioninfo you want to update (just recompile it with a lower version for testing)
3. Drop the component onto your GUI form
4. Set the properties:
ProjectType=auGitHubUpdateZip
GitHubProjectName=<your project name in GitHub>
GitHubUserName=<your user name in GitHub>
VersionsININame=<the filename you uploaded in (2)>
ZipFileName=<the filename you uploaded in (1)

Depending on the OS, put the appropriate updater executable updatehmxxx(.exe) in the same folder as your compiled app. (the compiled versions are included in the component directory, else compile them yourself from the supplied source)

Try the methods in the included TestApp or in your own:
LazAutoUpdate1.NewVersionAvailable
LazAutoUpdate1.DownLoadNewVersion
LazAutoUpdate1.UpDateToNewVersion
LazAutoUpdate1.AutoUpdate (which does all of the above, but in one call)

Check out the included TestApp code for a better idea of how to use the methods. It should work for win32 'out of the box' (remember to copy updatehmwin32.exe into the 'compiled' folder)  If it works OK then just change the properties of lazautoupdate1 for your GitHub test.

Long post, but as I said, I haven't done the docs, yet.  Any probs - just post me the properties you used in (4) and I'll test.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 03:04:44 pm
Ok seems easy, I will try it.

Just a question, why using master instead of releases?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 03:11:12 pm
If you work with me, we can probably get it working with releases.  My problem is lack of a test GitHub platform.  I have an old account with just a 'master' repository for testing :(

Follow the steps for master and test, but also upload testappwin32.ini andtestappwin32.zip to a release, give me the info and I can give it a go.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 15, 2017, 03:14:14 pm
@minesadorada, @lainz
After you're done with testing and a stable version is ready, I will add it to OPM as default.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 03:14:29 pm
If you work with me, we can probably get it working with releases.  My problem is lack of a test GitHub platform.  I have an old account with just a 'master' repository for testing :(

Ok. I will create a project for testing, I'm not in my PC with all the stuff so maybe in some hours later, first I will try it with the master to ensure that works, and then we can see how to develop it with releases.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 03:20:31 pm
@minesadorada, @lainz
After you're done with testing and a stable version is ready, I will add it to OPM as default.
Hi GetMem, V0.2.2.0 is still an alpha - I have to add better errorchecking/exception handling in the new code to make it a proper beta.
No hay prisa - I'm done with foobotting and will work on LazAutoUpdate for a bit.. :)
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 04:00:40 pm
Hi, here is the test project:
https://github.com/lazarusccr/TestLazAutoUpdate

I think I did all the steps right, the application is downloaded but when comes the time to get installed is not happening, I always stay at 0.0.0.0 (the online one is 1.0.0.0). I of course run it as administrator.

Also there's a memory leak somewhere.

The log:

 [2017-01-15 11:57:40.858 Info] Start of Log
 [2017-01-15 11:57:40.858 Info] updatehm version 0.0.15
 [2017-01-15 11:57:40.859 Info] Given parameters follow:
 [2017-01-15 11:57:40.859 Info] App name = testproject.exe
 [2017-01-15 11:57:40.859 Info] Updates folder = updates
 [2017-01-15 11:57:40.859 Info] WhatsNew filename = whatsnew.txt
 [2017-01-15 11:57:40.859 Info] Pretty Name = testproject
 [2017-01-15 11:57:40.859 Info] CopyTree = TRUE
 [2017-01-15 11:57:40.859 Info] Please wait.  Updating testproject....
 [2017-01-15 11:57:40.860 Info] Application path = C:\Users\Damian\Documents\GitHub\TestLazAutoUpdate\bin\testproject.exe
 [2017-01-15 11:57:40.860 Info] Updated application path = C:\Users\Damian\Documents\GitHub\TestLazAutoUpdate\bin\updates\testproject.exe
 [2017-01-15 11:57:40.860 Info] WhatsNew path = C:\Users\Damian\Documents\GitHub\TestLazAutoUpdate\bin\whatsnew.txt
 [2017-01-15 11:57:40.860 Info] Updated whatsNew path = C:\Users\Damian\Documents\GitHub\TestLazAutoUpdate\bin\updates\whatsnew.txt
 [2017-01-15 11:57:40.861 Info] Writing.. whatsnew.txt
 [2017-01-15 11:57:40.861 Info] Waiting 2 seconds...
[2017-01-15 11:57:42.863 Info] Copy to C:\Users\Damian\Documents\GitHub\TestLazAutoUpdate\bin\updates\testproject.exe failed
 [2017-01-15 11:57:42.863 Info] Restarting testproject...
 [2017-01-15 11:57:42.870 Info] End of Log
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 04:24:39 pm
Thanks for testing.

Downloaded your test project. Works fine for me.
Did your \bin\updates\ folder contain the exe and whatsnew.txt?
Did the \bin folder contain newTestLazAutoUpdate.ini and whatsnew.txt?

Here's my log:
[2017-01-15 15:16:59.273 Info] Start of Log
 [2017-01-15 15:16:59.273 Info] updatehm version 0.0.15
 [2017-01-15 15:16:59.273 Info] Given parameters follow:
 [2017-01-15 15:16:59.273 Info] App name = testproject.exe
 [2017-01-15 15:16:59.273 Info] Updates folder = updates
 [2017-01-15 15:16:59.273 Info] WhatsNew filename = whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Pretty Name = testproject
 [2017-01-15 15:16:59.273 Info] CopyTree = TRUE
 [2017-01-15 15:16:59.273 Info] Please wait.  Updating testproject....
 [2017-01-15 15:16:59.273 Info] Application path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\testproject.exe
 [2017-01-15 15:16:59.273 Info] Updated application path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\updates\testproject.exe
 [2017-01-15 15:16:59.273 Info] WhatsNew path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Updated whatsNew path = D:\lazarusccr\components\lazautoupdate\latest_stable\updates\TestLazAutoUpdate-master\TestLazAutoUpdate-master\bin\updates\whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Writing.. whatsnew.txt
 [2017-01-15 15:16:59.273 Info] Waiting 2 seconds...
 [2017-01-15 15:17:03.417 Info] Restarting testproject...
 [2017-01-15 15:17:03.431 Info] End of Log


Laz reports no memory leak on successful completion. I need to put in more code to allow for failure - it's a work-in-progress.

So I can't reproduce the error you reported so far.

Try the TestApp - it reports in more detail.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 04:39:58 pm
Quote
Did your \bin\updates\ folder contain the exe and whatsnew.txt?
Yes.
Quote
Did the \bin folder contain newTestLazAutoUpdate.ini and whatsnew.txt?
Yes.

TestApp works fine for me.

I'm using Lazarus 1.6 with FPC 3.0, in wich version you tested?
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 04:47:52 pm
OK I found the problem: compiling it with Debug doesn't works, it must be compiled as release to work, at least on my PC with Laz 1.6.

Edit: I don't know what was wrong, now compiling with Debug works fine too, that was a problem with something else.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 04:54:13 pm
Well, now that I tested it works really well, I have another question:

How I get the silent version of the command line tool?

And now we can see how to add it using releases instead of master, here is a release:

https://github.com/lazarusccr/TestLazAutoUpdate/releases/tag/v1.0 (This is just a page, not a download)
https://github.com/lazarusccr/TestLazAutoUpdate/releases/download/v1.0/TestLazAutoUpdate.ini
https://github.com/lazarusccr/TestLazAutoUpdate/releases/download/v1.0/TestLazAutoUpdate.zip

So you can see the format it has. The release can have any name, doesn't need to be "v" and "number" can be like "updates" too. So the thing we can do maybe is:

Add 'GitHubDownloadFromReleases' boolean, if true use the releases, if false use 'master'.

Then if DownloadFromReleases is true you can set GitHubReleaseName, a string to set it for example to "updates" or "v1.0", that's the subfolder of the URL.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 05:10:59 pm
>>How I get the silent version of the command line tool?
Not sure what you mean.  The method SilentUpdate is for use by a trayapp updater.  I haven't integrated that yet.

re releases:  I'll add it as an option to the ProjectType for consistency with the GitHubReleaseName property. (assuming the download URL works OK)

I'm glad it's working for you so far.  Thanks for uploading the test files - I'll get onto it after Ronnie O'Sullivan's snooker match finishes..

Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 05:17:23 pm
I almost forget, to download from HTTPS (GitHub releases are) you need to put the dll's in the program folder or have them installed in the system.

Quote
Not sure what you mean.  The method SilentUpdate is for use by a trayapp updater.  I haven't integrated that yet.

Ok.

Quote
re releases:  I'll add it as an option to the ProjectType for consistency with the GitHubReleaseName property. (assuming the download URL works OK)

Yes I've downloaded from that and works fine, the only thing your program needs if I remember well is an user agent like "client.AddHeader('User-Agent','Mozilla/5.0 (compatible; fpweb)');" that was for TFPHTTPClient, I'm not sure what you're using.

Ok. I think you can reuse the UpdatesFolder property instead of adding a new one. The UpdatesFolder will be the release name in that case. "v1.0". So only adding the project type will do.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 06:49:56 pm
Hmm. Complicated.  Github has branches, tags, branches with tags  etc.etc.  I'm still trying to get a binary download URL for tags and releases to work.

I need to set up my own GitHub test environment.  Watch this space.

>>I almost forget, to download from HTTPS (GitHub releases are) you need to put the dll's in the program folder or have them installed in the system.
Yes I forgot about those.  I'll figure out a way to download them (like fpcup) or put them into the distribution or something.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 15, 2017, 07:16:27 pm
Quote
Yes I forgot about those.  I'll figure out a way to download them (like fpcup) or put them into the distribution or something.
You can always download those dll's from the main repository like this(feel free to modify a few variables according to your needs).

Code: Pascal  [Select][+][-]
  1. const
  2. {$ifdef win64}
  3.  cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-x64_86-win64.zip';
  4. {$endif}
  5. {$ifdef win32}
  6. cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-i386-win32.zip';
  7. {$endif}
  8.  
  9. procedure CheckForOpenSSL;
  10. var
  11.   ZipFile: String;
  12.   UnZipper: TUnZipper;
  13. begin
  14.   {$IFDEF MSWINDOWS}
  15.    FOpenSSLAvaialable := FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'libeay32.dll') and
  16.                          FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'ssleay32.dll');
  17.    if not FOpenSSLAvaialable then
  18.    begin
  19.      ZipFile := ExtractFilePath(ParamStr(0)) + ExtractFileName(cOpenSSLURL);
  20.      try
  21.        FHTTPClient.Get(cOpenSSLURL, ZipFile);
  22.      except
  23.      end;
  24.      if FileExistsUTF8(ZipFile) then
  25.      begin
  26.        UnZipper := TUnZipper.Create;
  27.        try
  28.          try
  29.            UnZipper.FileName := ZipFile;
  30.            UnZipper.Examine;
  31.            UnZipper.UnZipAllFiles;
  32.          except
  33.          end;
  34.        finally
  35.          UnZipper.Free;
  36.        end;
  37.        DeleteFileUTF8(ZipFile);
  38.        FOpenSSLAvaialable := FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'libeay32.dll') and
  39.                              FileExistsUTF8(ExtractFilePath(ParamStr(0)) + 'ssleay32.dll');
  40.      end;
  41.   end;
  42.   {$ELSE}
  43.   FOpenSSLAvaialable := True;
  44.   {$ENDIF}
  45. end;

Under linux/osx it's installed by default.  You can also store the zip files on a personal server if you like.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 07:23:54 pm
Great minds think alike.  I was going to use http://indy.fulgan.com/SSL/openssl-1.0.2j-i386-win32.zip (http://indy.fulgan.com/SSL/openssl-1.0.2j-i386-win32.zip) but the lazarus URL is better.
Your code looks good.  I'll put it into a unit.  Thanks!

==Update==
V0.2.3.0 now downloads OpenSSL files.  Thanks GetMem and lainz - this is what the forum is all about :)
I made a self-contained unit open_ssl from GetMem's code if anyone wants it.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 08:19:26 pm
Just a thing: When the application runs the .exe updater it runs minimized, there's a reason for that? I need it normal to display correctly the 'you want to run this application' if the application needs to run as administrator. If no needs to run as administrator it has sense to keep it minimized of course.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 08:33:25 pm
Just a thing: When the application runs the .exe updater it runs minimized, there's a reason for that? I need it normal to display correctly the 'you want to run this application' if the application needs to run as administrator. If no needs to run as administrator it has sense to keep it minimized of course.
The console updater window is shelled in admin mode in Windows (using 'runas')  Windows 10 requires it to be shelled that way, so I don't have the control that TAsyncProcess properties bring.
It runs in a small window on my system, and that may be a user windows setting.
I chose a console rather than a GUI because I think it's more user-friendly (and linux-friendly) but it would be trivial to put the updatehm code into a GUI if required.

Did I understand your question?  I don't have an army of testers, so any feedback on different systems is valuable.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 08:55:30 pm
Ok. It starts minimized on Windows 10, at least on my PC. For that I think the user will not notice it directly, I don't know if swicthing to a GUI will solve that.

Of course when I click the icon in the taskbar it displays the yes no buttons to run or not it. And then the console is shown as always.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 10:19:18 pm
Oh I See.  I don't get a Yes/No prompt on my system, where I run as admin.  For me, the update is non-interactive.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 15, 2017, 11:10:38 pm
You have UAC disabled or configured in a lower setting?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 15, 2017, 11:47:06 pm
You have UAC disabled or configured in a lower setting?
First thing I did when 'upgrading' to Windows 10.
I saw some stuff online about working with UAC programmatically - there should be a solution out there.
Meanwhile I'll concentrate on GitHub integration.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 16, 2017, 12:36:19 pm
GitHub branches working.
ToDo: Tags
ToDo: UAC

V0.2.4.0 in OPM
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 16, 2017, 01:23:47 pm
Well, I enabled Windows 10 UAC and did a lazautoupdate.
As expected, it asked me if I wanted to run the update console app via an annoying modal dialog, and when I said 'OK' it ran it but minimized, just as Lainz posted earlier.

It did update OK though, and it didn't look weird.

re GitHub tags: I need to figure out what they are and how to make them before proceeding.  I'm not sure tag functionality is useful when designing an app with updates.  Wouldn't any new versions of apps go into a branch?
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 16, 2017, 01:43:12 pm
Little bit of a hiccup with OPM and LazUpdate.

When I launched OPM it said there were no updates to LazUpdate package. Clicking on the Update link (JSON) caused it to reload and it showed an update for 0.2.4.0. I updated and rebuilt Lazarus. Now OPM shows that I have 0.2.4.0 installed, repository is 0.2.1.0 and Update is 0.2.4.0 and it's telling me that there is a new update to 0.2.4.0 available.

See attached image
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 16, 2017, 01:56:13 pm
All is good.  If I publish an update, but don't increase the version number OPM recognises that.
If you click 'Update' the 'New' notification will go away. Current version is 0.2.4.0.

Have you tested LazautoUpdate yet?
It's still under development, but will do it's basic job of updating apps from Sourceforge or GitHub OK AFAIK.

=edit= I've turned the notification off.  Only new version numbers will trigger OPM's 'New'
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 16, 2017, 01:59:07 pm
I did update Laz AutoUpdate from OPM and that was the image after the update. The "NEW' notification stays there. Not a big issue.

As far as testing it in the real world, I will do so with my next release of my application.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 16, 2017, 02:14:41 pm
Good news - with some trepidation I booted into 64-bit Linux, and ran the TestApp which updates from a GitHub release.  I haven't done this since the rewrite.

All good!  The console app doesn't show, which is OK - the update goes quickly and smoothly.

Logfile from TestApp:
[2017-01-16 13:11:22.224 Info] Start of Log
 [2017-01-16 13:11:22.264 Info] Debug Message: (ShowWhatsNewIfAvailable) Unable to locate whatsnew.txt
 [2017-01-16 13:11:30.777 Info] Debug Message: (NewVersionAvailable) URL is https://raw.github.com/lazarusccr/TestApp/TestBranch/updates/testapplinux64.ini
 [2017-01-16 13:11:30.777 Info] Debug Message: (NewVersionAvailable) Target Path /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:30.778 Info] Debug Message: (NewVersionAvailable) Deleted old file /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:30.779 Info] Debug Message: (NewVersionAvailable) ThreadDownloadHTTP return Code was 0
 [2017-01-16 13:11:30.793 Info] Debug Message: (NewVersionAvailable) ThreadDownloadHTTP Last Error was OK
 [2017-01-16 13:11:32.527 Info] Debug Message: (NewVersionAvailable) After Threadfinished: Return Code was 200
 [2017-01-16 13:11:32.528 Info] Debug Message: (NewVersionAvailable) Downloaded /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini OK
 [2017-01-16 13:11:32.531 Info] Debug Message: (IsSourceForgeVersionNewer) fGUIOnlineVersion=1.1.1.1, fApplicationVersionString=0.0.1.0, szTempXMLPath=/mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:32.531 Info] Debug Message: (NewVersionAvailable) Downloaded /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini: 25 bytes
 [2017-01-16 13:11:32.531 Info] New version available. Online Version is 1.1.1.1
 [2017-01-16 13:11:35.753 Info] Debug Message: (AutoUpdate) Calling NewVersionAvailable
 [2017-01-16 13:11:35.754 Info] Debug Message: (NewVersionAvailable) URL is https://raw.github.com/lazarusccr/TestApp/TestBranch/updates/testapplinux64.ini
 [2017-01-16 13:11:35.754 Info] Debug Message: (NewVersionAvailable) Target Path /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:35.755 Info] Debug Message: (NewVersionAvailable) Deleted old file /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:35.755 Info] Debug Message: (NewVersionAvailable) ThreadDownloadHTTP return Code was 0
 [2017-01-16 13:11:35.756 Info] Debug Message: (NewVersionAvailable) ThreadDownloadHTTP Last Error was OK
 [2017-01-16 13:11:36.927 Info] Debug Message: (NewVersionAvailable) After Threadfinished: Return Code was 200
 [2017-01-16 13:11:36.928 Info] Debug Message: (NewVersionAvailable) Downloaded /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini OK
 [2017-01-16 13:11:36.931 Info] Debug Message: (IsSourceForgeVersionNewer) fGUIOnlineVersion=1.1.1.1, fApplicationVersionString=0.0.1.0, szTempXMLPath=/mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini
 [2017-01-16 13:11:36.931 Info] Debug Message: (NewVersionAvailable) Downloaded /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/newtestapplinux64.ini: 25 bytes
 [2017-01-16 13:11:36.931 Info] New version available. Online Version is 1.1.1.1
 [2017-01-16 13:11:36.931 Info] Debug Message: (AutoUpdate) NewVersionAvailable succeeded
 [2017-01-16 13:11:39.369 Info] Debug Message: (AutoUpdate) Calling DownloadNewVersion
 [2017-01-16 13:11:39.369 Info] Debug Message: (DownloadNewVersion) Download parameters: TargetPath=testapplinux64.zip
URL=https://raw.github.com/lazarusccr/TestApp/TestBranch/updates/testapplinux64.zip
UpdatesFolder=/mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/updates
 [2017-01-16 13:11:39.372 Info] Debug Message: (DownloadNewVersion) New directory /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/updates was created
 [2017-01-16 13:11:39.372 Info] Debug Message: (DownloadNewVersion) szURL=https://raw.github.com/lazarusccr/TestApp/TestBranch/updates/testapplinux64.zip, szTargetPath=/mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/updates/testapplinux64.zip
 [2017-01-16 13:11:44.455 Info] Debug Message: (DownloadNewVersion) Downloaded testapplinux64.zip: 1051184 bytes
 [2017-01-16 13:11:44.455 Info] Debug Message: (DownloadNewVersion) Downloaded new version 1.1.1.1 sucessfully.
 [2017-01-16 13:11:44.455 Info] Downloaded. StatusCode=200 BytesDownloaded=1051184
 [2017-01-16 13:11:44.455 Info] Debug Message: (AutoUpdate) DownloadNewVersion suceeded
 [2017-01-16 13:11:46.833 Info] Debug Message: (AutoUpdate) Calling UpdateToNewVersion
 [2017-01-16 13:11:46.833 Info] Debug Message: (UpdateToNewVersion) Entering UpdateToNewVersion
 [2017-01-16 13:11:46.856 Info] Debug Message: (UpdateToNewVersion) Executing /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/updatehmlinux64
 [2017-01-16 13:11:46.857 Info] Debug Message: (UpdateToNewVersion) Waiting for /mnt/sde1/lazarusccr/components/lazautoupdate/latest_stable/testapp/compiled/linux64/whatsnew.txt
 [2017-01-16 13:11:46.872 Info] Debug Message: (UpdateToNewVersion) Success
 [2017-01-16 13:11:46.872 Info] End of Log
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 16, 2017, 04:53:10 pm
Quote
re GitHub tags: I need to figure out what they are and how to make them before proceeding.  I'm not sure tag functionality is useful when designing an app with updates.  Wouldn't any new versions of apps go into a branch?

Is usefull, because you use the correct downloads place.

Think about it's a folder. Then you can set up a tag 'updates' like for the master branch, but instead of the master branch it's a tag. So you put the ini and zip under that tag (as release), and each update you delete the old files and upload the new files.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 16, 2017, 05:02:56 pm
I couldn't see any way to make a tag in the GitHub web interface (you can make a release).  How is it done?
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 16, 2017, 05:09:46 pm
I couldn't see any way to make a tag in the GitHub web interface (you can make a release).  How is it done?

Yes is a bit hidden, it was happening to me the first time that I couldn't find that
https://github.com/lazarusccr/TestApp/releases

I've created the 'updates' release. You can click on the edit button and add some files, the ini and the zip.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 17, 2017, 10:32:49 am
V0.2.5.0 in OPM

* After looking at the windows 10 'permissions' issue, I've come to the conclusion that even if I put 'hacky' code in to enable a non-admin user to update an app 'in-place' it would be a bad idea.  It would make LazAutoUpdate apps into potential malware.
* If a non-admin Windows user runs LazAutoUpdate.AutoUpdate, everything runs smoothly until the actual update is ready, then a dialog shows asking the user to switch to an admin account in order to do the update, and it exits there.
* If in Windows admin mode, and UAC is switched up to maximum, the UAC warning appears, and an admin account can okay it and the update runs.

I believe this is correct behaviour for an updater running under Windows 10.
Title: Re: Laz AutoUpdate component - beta
Post by: Thaddy on January 17, 2017, 10:40:44 am
Does a properly formatted manifest resource help? Or is that already used? (Didn't look)
If Administrator is needed,afaik as the rights are defined as AsAdmin the dialog won't pop-up.
If the user already has update/install rights, AsInvoker also won't pop-up any dialog.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 17, 2017, 10:58:12 am
Hi Thaddy,
As I understand it, a manifest would apply to an app, not a component.  It's up to the app writer how it does its security.  As the App is the 'invoker' of LazAutoUpdate, I would assume the rights promulgate.

But for reasons explained, I'd rather an update component like LazAutoUpdate didn't try to circumvent Windows 10 security (such that it is).  I actually agree with windows that only admin users should have the security access to overwrite app files in-place from an internet source.

For Linux users and windows admins, it's not an issue.

==edit I've added a non-published boolean public property 'WindowsAdminCheck' (default=true) for devs to override my opinion :) ==
Title: Re: Laz AutoUpdate component - beta
Post by: Thaddy on January 17, 2017, 11:44:22 am
Hi Thaddy,
As I understand it, a manifest would apply to an app, not a component.  It's up to the app writer how it does its security.  As the App is the 'invoker' of LazAutoUpdate, I would assume the rights promulgate.

But for reasons explained, I'd rather an update component like LazAutoUpdate didn't try to circumvent Windows 10 security (such that it is).  I actually agree with windows that only admin users should have the security access to overwrite app files in-place from an internet source.

For Linux users and windows admins, it's not an issue.

==edit I've added a non-published boolean public property 'WindowsAdminCheck' (default=true) for devs to override my opinion :) ==
Then check the manifest for Lazarus...
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 17, 2017, 11:56:49 am
Quote
@Thaddy
Then check the manifest for Lazarus..
What Lazarus? The update is performed by a user who has no knowledge about Lazarus or package AutoUpdate.

@minesadorada
In my opinion this is the correct behaviour.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 17, 2017, 12:57:54 pm
I couldn't see any way to make a tag in the GitHub web interface (you can make a release).  How is it done?

Yes is a bit hidden, it was happening to me the first time that I couldn't find that
https://github.com/lazarusccr/TestApp/releases

I've created the 'updates' release. You can click on the edit button and add some files, the ini and the zip.
Update V0.2.6.0:

LazAutoUpdate property GitHubBranchOrTag (default=master)
This will take a Branch name or a Tag name
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 18, 2017, 09:55:16 am
V0.2.6.0

* Added UpdatePack source to OPM package.
* The update pack will update itself of course, and also the LazAutoUpdate component.
* Compiles to Win32/64 and Linux32/64
* Be sure to compile the console updater and deploy it to the Update Pack executable folder before using it.
* Available via OPM
* Or: https://sourceforge.net/projects/lazautoupdate/ (https://sourceforge.net/projects/lazautoupdate/) In there is a setup for Windows and Linux binaries that get you started right away.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 18, 2017, 07:26:14 pm
Updated Wiki Page for LazAutoUpdate:  http://wiki.freepascal.org/LazAutoUpdater (http://wiki.freepascal.org/LazAutoUpdater)

Now includes easy instructions for deployment, and a link to download via SourceForge.

LazAutoUpdate is also available via GetMem's excellent OnlinePackageManager
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 20, 2017, 03:09:47 am
Thanks for updating this. However I sometimes get the error I talked about some days ago, it downloads but doesn't update.. then a memory leak window is shown. I have no idea on how to debug it.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 20, 2017, 09:32:31 am
Thanks for updating this. However I sometimes get the error I talked about some days ago, it downloads but doesn't update.. then a memory leak window is shown. I have no idea on how to debug it.
Hi Lainz:  Set DebugMode=TRUE then log the OnDebugEvent http://wiki.freepascal.org/LazAutoUpdater#Debugging (http://wiki.freepascal.org/LazAutoUpdater#Debugging)
The TestApp has code to do it.

==Update==
The memory leak was from the TestApp logger I think.  Updated in OPM.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 20, 2017, 07:08:25 pm
@minesadorado - Can you help me with something? I've implemented your code for using the autoupdater but I am getting the following error:


When loading my main form, I have this segment of code:
Code: Pascal  [Select][+][-]
  1.   if LazAutoUpdate1.NewVersionAvailable then
  2.     if WyckerLogLevel = 1 then
  3.       begin
  4.         Logger.Info(sNewVersionAvailable);
  5.       end;
  6.     MessageDlg(Application.Title, sNewVersionAvailable, mtConfirmation, [mbOK], 0);
  7.  
What I expect to happen is that, if there is an update, the user will be notified and if not, nothing will happen. I have not yet created an UpdatePack fo my app and have not yet uploaded a version.ini file to SourceForge yet, although I do have the directory structure on SourceForge setup and ready. When my program starts and tnhat code block is executed, I get a dialog that says there is a new update available, which is wrong as there's no version.ini to compare against.

This code, when executed, says there is no update available,as expected:
Code: Pascal  [Select][+][-]
  1. //Main menu check for Wycker Update
  2. procedure Tfrm_wyckermain.MenuItem14Click(Sender: TObject);
  3. begin
  4.   //Check for Wycker Update
  5.   if WyckerLogLevel = 1 then
  6.     Logger.Info(sLoggerChkUpd);
  7.     If LazAutoUpdate1.NewVersionAvailable Then
  8.       If LazAutoUpdate1.DownloadNewVersion Then
  9.         Begin
  10.           If MessageDlg(Application.Title, sUpdDownloadComplete, mtInformation, [mbOK], 0) = 1 then
  11.             LazAutoUpdate1.UpdateToNewVersion
  12.         End
  13.       Else
  14.         begin
  15.           if WyckerLogLevel = 1 then
  16.             Logger.Info(sLoggerChkUpdFailed);
  17.           ShowMessage(sUpdDownloadFailed)
  18.         end
  19.     Else
  20.       if WyckerLogLevel = 1 then
  21.         Logger.Info(sLoggerChkUpdNone);
  22.       ShowMessage(sUpdNoUpdate);
  23. end;
  24.  

It's prolly something so simple that I'll be embarrassed when you point it out to me.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 20, 2017, 08:33:36 pm
Indented correctly, you can see the error.  The MessageDlg will always show.
Code: Pascal  [Select][+][-]
  1. if LazAutoUpdate1.NewVersionAvailable then // If NewVersionAvailable block starts here
  2.    if WyckerLogLevel = 1 then
  3.     begin
  4.       Logger.Info(sNewVersionAvailable);
  5.     end; // If NewVersionAvailable block ends here
  6. MessageDlg(Application.Title, sNewVersionAvailable, mtConfirmation, [mbOK], 0); // << Outside the If..then block
  7.  

You need to use Begin..End blocks with every if..then statement to be sure. In general, keep to the rule: 'After a then, always a begin'
Tip1: If you keep to the rule, in the Laz editor pane, when you click on a 'begin' it will highlight the corresponding 'end'
Tip2: When the if.thens behave 'funny' try Jedi Formatting the code - it will show the blocks (and any errors) more clearly. It's the "poor man's syntax checker"
Tip3: Don't worry about source code looking 'wordy' - the compiler strips out 'wordy' stuff anyway so generally it's all the same, and 'wordy' correctly indented code is usually easier to debug and maintain.

This code should do as you want:
Code: Pascal  [Select][+][-]
  1. if LazAutoUpdate1.NewVersionAvailable then
  2. Begin // If NewVersionAvailable block starts here
  3.    if WyckerLogLevel = 1 then
  4.     begin
  5.       Logger.Info(sNewVersionAvailable);
  6.     end;
  7.   MessageDlg(Application.Title, sNewVersionAvailable, mtConfirmation, [mbOK], 0); // << Inside the If..then block
  8. end; // If NewVersionAvailable block ends here
  9.  

Note: When you get Update Pack working, remember use it to update itself and the LazAutoUpdate code every so often.  As I write, the LazAutoUpdate suite is still under active development.
Title: Re: Laz AutoUpdate component - beta
Post by: Rayvenhaus on January 20, 2017, 10:46:15 pm
That worked perfectly, thank you for the explanation and I have learned yet another thing about Pascal!
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 23, 2017, 11:49:20 am
Now reworking the LazTrayUpdater.

This is why I wrote LongTimer; The app sits in the System tray, and checks for updates on a user-defined schedule (every day, once a week, once a month etc)  If it finds one, it can update the app (whether it is running or not).

The idea is to emulate Windows background Update service - but for your Lazarus app, and in Linux as well as Windows.  It was my original vision of LazAutoUpdate, but I got distracted into writing a visual component, then LongTimer...

We'll see: watch this space...
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 25, 2017, 02:09:22 pm
Everything is working, however uploads to SourceForge are not good for some reason, so use OnlinePackageManager for the latest code.

LazTrayUpdater is working OK as I write.  During an update, LazAutoUpdate automatically creates an update file that TrayUpdater can use to schedule further updates.

It's really difficult to test, (I have to wait for a scheduled daily update) but looking good.
Title: Re: Laz AutoUpdate component - beta
Post by: esvignolo on January 25, 2017, 04:02:13 pm
Hi, i have permission's problem on linux, because i made a .deb, wich install on /opt/ directory, and when my application run the binary "updatehm", this binary, need permission on the /opt/myapplicacion for make the replacement.

Any idea how resolve this?
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 25, 2017, 05:47:46 pm
Hi, i have permission's problem on linux, because i made a .deb, wich install on /opt/ directory, and when my application run the binary "updatehm", this binary, need permission on the /opt/myapplicacion for make the replacement.

Any idea how resolve this?
This is a Linux permissions question, of which I am far from expert.  How do other Linux apps update themselves - do they install into a different directory?

LazAutoUpdate is very conservative when it comes to permissions.  As an open-source component that downloads and installs executables from the internet, I don't want it used for nefarious purposes.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 25, 2017, 06:20:27 pm
LazAutoUpdate is very conservative when it comes to permissions.  As an open-source component that downloads and installs executables from the internet, I don't want it used for nefarious purposes.

LOL, I've seen his application personally, is a POS software.
Quote
This is a Linux permissions question, of which I am far from expert.  How do other Linux apps update themselves - do they install into a different directory?

It depends on how you install it, if you do via the app manager it get's updated automatically by the OS. But since we're talking here for a commercial application it can't be updated this way.

LazAutoUpdate needs to prompt the user for permission as it does under Windows.
Title: Re: Laz AutoUpdate component - beta
Post by: esvignolo on January 25, 2017, 10:27:00 pm
Is a permissions problem (but not by the application), if you put the binarys into a shared directory, like others shared binary (how windows or linux works like) when the updatehm make the repleacement, need a elevation, because in this case (or any case, which the binary is in a shared folder, like C:\program files or \opt\), in windows the updatehm request elevation, and this elevetion is a answer to the user to confirm that. But in linux, the common way is use gksudo or kdesudo.

My answer is, if anybody deal with this problem before, or suggestions, because i think this is a common problem, in this scenario.

Thanks

LazAutoUpdate is very conservative when it comes to permissions.  As an open-source component that downloads and installs executables from the internet, I don't want it used for nefarious purposes.

LOL, I've seen his application personally, is a POS software.
Quote
This is a Linux permissions question, of which I am far from expert.  How do other Linux apps update themselves - do they install into a different directory?

It depends on how you install it, if you do via the app manager it get's updated automatically by the OS. But since we're talking here for a commercial application it can't be updated this way.

LazAutoUpdate needs to prompt the user for permission as it does under Windows.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 25, 2017, 10:54:14 pm
Quote
My answer is, if anybody deal with this problem before, or suggestions, because i think this is a common problem, in this scenario.
Am I right in thinking the console updater needs elevated permissions?  Surely that would be up to whatever app installer is used to deploy it - if the app installer grants permissions to the updater, is there a problem then?

My only Linux tests so far have been under a root account (where it obviously works fine)

AFAIK Linux installers (apt etc) are tightly controlled via certificates/GPG keys etc. - way beyond my Linux knowledge..
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 26, 2017, 12:41:20 am
Update To V0.3.0.0

TrayUpdater systray app code now integrated into the component.
SourceForge LazAutoUpdate project files updated.

I'd appreciate any ideas on how the console updater can ask permission in Linux to do its stuff.  It is launched as an AsyncProcess from the component code.  I just don't have the requisite Linux knowledge to do it.
I'd like to know how to determine if the console updater has enough rights under the current useraccount (which seems to be the issue) to overwrite an executable
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 26, 2017, 07:38:48 am
Quote
I'd appreciate any ideas on how the console updater can ask permission in Linux to do its stuff.  It is launched as an AsyncProcess from the component code.  I just don't have the requisite Linux knowledge to do it.
I'd like to know how to determine if the console updater has enough rights under the current useraccount (which seems to be the issue) to overwrite an executable
Just set the execution permission for the console updater with the chmod command.  Chmod will ask for credentials when needed. Like this:
Code: Pascal  [Select][+][-]
  1. function SetExecutePermission(const AFileName: String; var AErrMsg: String): Boolean;
  2. var
  3.   SL: TStringList;
  4.   Process: TProcess;
  5. begin
  6.   Result := False;
  7.   Process := TProcess.Create(nil);
  8.   try
  9.     Process.Executable := '/bin/chmod';
  10.     Process.Parameters.Add('+X');
  11.     Process.Parameters.Add(AFileName);
  12.     Process.Options := Process.Options + [poWaitOnExit, poUsePipes];
  13.     Process.Execute;
  14.     SL := TStringList.Create;
  15.     try
  16.       SL.LoadFromStream(Process.Stderr);
  17.       AErrMsg := Trim(SL.Text);
  18.       Result := Trim(AErrMsg) = '';
  19.     finally
  20.       SL.Free;
  21.     end;
  22.   finally
  23.     Process.Free;
  24.   end;
  25. end;
  26.  
  27. procedure TForm1.Button1Click(Sender: TObject);
  28. var
  29.   ErrMsg: String;
  30. begin
  31.   if SetExecutePermission('/minesadorada/developer/updates/consoleupdater', ErrMsg) then
  32.     MessageDlg('Permission successfully set.', mtInformation, [mbOk], 0)
  33.   else
  34.     MessageDlg('Cannot set permission. Error message: ' + ErrMsg, mtError, [mbOk], 0);
  35. end;
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 26, 2017, 08:47:34 am
@GetMem That's pretty much what I needed.  Thanks!
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 27, 2017, 01:08:19 pm
Update to V0.3.4.0

* Added functions to make and delete a desktop shortcut (Linux implementation not yet functional)
* This is to help using LAU as an installer/updater
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 28, 2017, 06:01:50 pm
Update to V0.3.4.0

* Added functions to make and delete a desktop shortcut (Linux implementation not yet functional)
* This is to help using LAU as an installer/updater

I always was looking for an online setup tool, and never find one easy to deploy (or free), so this may be the case now with your tool, the first working. Also I did a google search and I find your wiki entry, so this can be more than a simple update tool. It can be a powerfull cross platform installer tool.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 28, 2017, 07:19:40 pm
Updated in the main repository to 0.3.5.0
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 28, 2017, 09:11:13 pm
V0.3.5.0: Linux desktop icon creation should be working.  I need to install a proper Linux environment to test - all I have ATM is a broken Mint 32-bit installation and a LiveCD Puppy Linux 64-bit (which doesn't keep to standards)

The Tray (silent) updater seems to be working well.

Still working on the component though.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 29, 2017, 09:58:38 am
Update to V0.3.6.0

There was a bug in V0.3.5.0 Windows MakeShortcut which caused a SegFault - now fixed.

@Getmem - please use V0.3.6.0 for the repository base - it is the most stable version.

ToDo: A generic installer/updater test app which uses both SourceForge and GitHub sources.  Also UpdatePack needs a few fixes.
Title: Re: Laz AutoUpdate component - beta
Post by: GetMem on January 29, 2017, 11:03:08 am
Quote
@Getmem - please use V0.3.6.0 for the repository base - it is the most stable version.
Done. Now the default version is V0.3.6.0.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 29, 2017, 01:42:33 pm
To V0.3.7.1

* A few tweaks to get an installer working properly (New property: WorkingMode=(lauInstall|lauUpdate)
* If the app is absent: Install it.  If the app is present or running: Update it.
* Works in Windows OK.
* Testing app in SVN (work-in-progress)

* Windows version (alpha) is here: https://sourceforge.net/projects/lazautoupdate/ (https://sourceforge.net/projects/lazautoupdate/)
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 30, 2017, 10:34:10 am
To V0.3.8

* MakeShortcut now makes a menu entry as well as a desktop shortcut in Windows
* Updated Installer app (and wiki docs)
* Updated Update Pack

With Property WorkingMode, your main app can:
* Update itseslf (WorkingMode=lauUpdate)
*  (WorkingMode=lauInstall) Install other apps programmatically (perhaps via a menu) which can also update themselves (WorkingMode=lauUpdate)
* All functionality automatically updates the TrayIcon app

With the TrayIcon app:
* Runs in the background, and silently checks and updates apps on a developer/user defined schedule (daily, weekly, monthly etc)
* When an update is done via LazAutoUpdate anywhere, the TrayIcon app picks it up automatically

ToDo: Improve the updating visually with a progress bar

Available via:
 https://sourceforge.net/projects/lazautoupdate/ (https://sourceforge.net/projects/lazautoupdate/)
svn: Lazarus ccr: https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable (https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable)
OnlinePackageManager: http://packages.lazarus-ide.org/ (http://packages.lazarus-ide.org/)
Wiki page: http://wiki.lazarus.freepascal.org/LazAutoUpdater (http://wiki.lazarus.freepascal.org/LazAutoUpdater)
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on February 13, 2017, 10:27:03 am
Updated Wiki with info about the Systray Updater companion app.  If you deploy an app with LazAutoUpdate consider also deploying the Systray Updater.  It will silently check for updates on a schedule and optionally silently update your app when it finds a newer version.  When an app is manually updated (via normal LazAutoUpdate), the systray app config file is automatically configured.  Runs under Windows or Linux,

It is designed for 'deploy once then forget' when run on Windows startup.

Wiki page: http://wiki.lazarus.freepascal.org/LazAutoUpdater (http://wiki.lazarus.freepascal.org/LazAutoUpdater)
Title: Re: Laz AutoUpdate component - beta
Post by: mdbs99 on May 22, 2017, 01:53:37 am
Hi @minesadorada

Why we have 2 options to get the sources?

1. https://sourceforge.net/projects/lazautoupdate/
2. https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable

Which one is official?

Thanks.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on May 22, 2017, 09:45:16 am
Hi @minesadorada

Why we have 2 options to get the sources?

1. https://sourceforge.net/projects/lazautoupdate/
2. https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/latest_stable

Which one is official?

Thanks.
Hi @mdbs99,
The CCR source is the one used by Online Package Manager, my own CVS source control and has the latest code.
The sourceforge site is a mirror, and is used for LazAutoUpdate's own updater, as well as compiled versions/installers etc.
Title: Re: Laz AutoUpdate component - beta
Post by: mdbs99 on May 22, 2017, 02:03:19 pm
Ok, I already have CCR sources so, I'll use it.

I didn't install yet, but I have one question (forgive me if is a dumb question).
I would like to use LazAutoUpdate (LAU) this way:
I will put my binaries in my server and configure LAU to check the binaries in the program initialization. If my server has a new version, the program should advise the user (I need to configure my own message) and abort. I mean, the user is not allow to use a old version, for secure reasons.

Is it possible to use like that?

Thank you.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on May 22, 2017, 05:48:24 pm
Ok, I already have CCR sources so, I'll use it.

I didn't install yet, but I have one question (forgive me if is a dumb question).
I would like to use LazAutoUpdate (LAU) this way:
I will put my binaries in my server and configure LAU to check the binaries in the program initialization. If my server has a new version, the program should advise the user (I need to configure my own message) and abort. I mean, the user is not allow to use a old version, for secure reasons.

Is it possible to use like that?

Thank you.

Take a look at the wiki page:
http://wiki.freepascal.org/LazAutoUpdater (http://wiki.freepascal.org/LazAutoUpdater)

There is a boolean function:

Code: Pascal  [Select][+][-]
  1. If LazAutoUpdate1.NewVersionAvailable then ..... else ...

which I think will suit your need.   It downloads a very small text file with the newest online version number and compares it with the VersionInfo information of your application.

If newer (returns TRUE), you can use the functions:

Code: Pascal  [Select][+][-]
  1. If LazAutoUpdate1.DownloadNewVersion then LazAutoUpdate1.UpdateToNewVersion

which will overwrite the old application with the new.

Set the property ShowDialogs=False in order to have full control of the UI.
Title: Re: Laz AutoUpdate component - beta
Post by: mdbs99 on May 22, 2017, 06:03:45 pm
Ok, looks great!

Thank you.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 25, 2020, 04:23:22 pm
Hi, I know this is an old thread, but is linked in the wiki as the official source for discussion, so I will write here.

Questions:

(I'm using FPC 3.3.1 and Lazarus 2.1.0 - trunk - from a week ago)

1) This is cross platform? Testing the latest version of LazAutoUpdate on Linux was not working for me. Also If I remember correctly didn't work as well on macOS, but I don't have a working installation of Lazarus and FPC on mac right now to test.

2) This is still being updated? I look a bit at the sources and it contains an old copy of fphttpclient grabbed originally from Online Package Manager. Looking at OPM sources seems that these are not needed anymore (I can't find the copy in the latest sources).
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 26, 2020, 09:39:02 am
Hi, I know this is an old thread, but is linked in the wiki as the official source for discussion, so I will write here.

Questions:

(I'm using FPC 3.3.1 and Lazarus 2.1.0 - trunk - from a week ago)

1) This is cross platform? Testing the latest version of LazAutoUpdate on Linux was not working for me. Also If I remember correctly didn't work as well on macOS, but I don't have a working installation of Lazarus and FPC on mac right now to test.
It was originally tested on Linux (Mint I think) but never on MacOS.  I rarely boot into Linux, so maybe something changed.  I remember the update was "silent" under Linux (i.e. no command dialog)

2) This is still being updated? I look a bit at the sources and it contains an old copy of fphttpclient grabbed originally from Online Package Manager. Looking at OPM sources seems that these are not needed anymore (I can't find the copy in the latest sources).
I haven't updated the code for a while (don't do much coding these days).  I considered replacing the fphttpclient, but "if it ain't broke, don't fix it"  The downloading facility still works fine on my Windows 10 x64 system.

You are more than welcome to review, refactor and generally improve the code - for instance a download progress dialog would be great.  I think it is quite a useful component to have, and I'm not aware of alternatives.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 26, 2020, 11:14:23 am
Indeed is a good component. And working fine on Windows, just on Linux was not working (Linux 32 bit).

Thanks, If I can somehow improve it I will for sure share it as you did.
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 26, 2020, 04:17:05 pm
In case you haven't already - det the DebugMode to TRUE and populate the Debug Mode event - it may help you debug the problems in Linux (at least it will tell you what the component is doing)

Code: Pascal  [Select][+][-]
  1. {in Form.Create}LazAutoUpdate1.DebugMode:=TRUE;
  2. {OI Event}procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
  3.   lauMessage: string);
  4. begin
  5.   ShowMessageFmt('Method: %s Message %s',[lauMethodName,lauMessage]);
  6. end;      
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 26, 2020, 04:40:38 pm
What I finally did was create a code mixing your component and some functions.

Checking the ini file with my code, not saving to file but to memory and reading the version/GUI string. Comparing in the same function. Downloading to file and extracting with your code.

Then I just called DoUpdate or a method called like that from your component, and it works, the problem is that the binary file is not being replaced, I mean the file thats calling the updatehm.

I was reading a bit and seems that the file must be deleted in order to get replaced, at least it didnt work in ubuntu 16, thats one of the latest supporting 32 bit...

Maybe I grab code from your component and make something that fits the app Im updating, but again your code works fine under Windows, and seems that on linux too the replace method, but it saves an empty ini file, dont know why, even using the latest fpcupdeluxe not the shipped one.

Is strange, for that I created the check version and download separated from the component, and let the component update the app.

If I can fix the replace of the binary file is working fully, at least in this hybrid mode...
Title: Re: Laz AutoUpdate component - beta
Post by: minesadorada on January 26, 2020, 06:33:21 pm
I will test in Linux Mint in the next couple of days.  Watch this space.
Title: Re: Laz AutoUpdate component - beta
Post by: lainz on January 26, 2020, 10:01:32 pm
I will test in Linux Mint in the next couple of days.  Watch this space.

Thankyou.

For your information if it helps: I'm using the mode auOther, in an http website (not secure) with FPC trunk and Lazarus trunk, on Linux 32 bit.

Maybe the code works for you and not for me in that distro, recently we had problems in some distros and in some other distros don't... So that can be too.
TinyPortal © 2005-2018