Recent

Author Topic: Laz AutoUpdate component - beta  (Read 49767 times)

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #90 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/ In there is a setup for Windows and Linux binaries that get you started right away.
« Last Edit: January 18, 2017, 12:44:06 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #91 on: January 18, 2017, 07:26:14 pm »
Updated Wiki Page for LazAutoUpdate:  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
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 3800
  • Leandro Diaz
Re: Laz AutoUpdate component - beta
« Reply #92 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.
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #93 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
The TestApp has code to do it.

==Update==
The memory leak was from the TestApp logger I think.  Updated in OPM.
« Last Edit: January 20, 2017, 12:41:44 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Rayvenhaus

  • Jr. Member
  • **
  • Posts: 80
Re: Laz AutoUpdate component - beta
« Reply #94 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.

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #95 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.
« Last Edit: January 20, 2017, 10:48:04 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

Rayvenhaus

  • Jr. Member
  • **
  • Posts: 80
Re: Laz AutoUpdate component - beta
« Reply #96 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!

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #97 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...
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #98 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.
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

esvignolo

  • Full Member
  • ***
  • Posts: 158
  • Using FPC in Windows, Linux, Macos
Re: Laz AutoUpdate component - beta
« Reply #99 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?

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #100 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.
« Last Edit: January 25, 2017, 06:08:31 pm by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

lainz

  • Hero Member
  • *****
  • Posts: 3800
  • Leandro Diaz
Re: Laz AutoUpdate component - beta
« Reply #101 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.
https://lainz.github.io/
Download LazPaint https://lazpaint.github.io/
Download BGRABitmap and BGRAControls https://github.com/bgrabitmap

esvignolo

  • Full Member
  • ***
  • Posts: 158
  • Using FPC in Windows, Linux, Macos
Re: Laz AutoUpdate component - beta
« Reply #102 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.

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #103 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..
« Last Edit: January 26, 2017, 12:58:21 am by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

minesadorada

  • Hero Member
  • *****
  • Posts: 605
  • Retired
Re: Laz AutoUpdate component - beta
« Reply #104 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
« Last Edit: January 26, 2017, 01:08:10 am by minesadorada »
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

 

TinyPortal © 2005-2018