Sign in Join
Wiki copytemporary

LazAutoUpdater

English · Polski · Русский

Summary


Download


Installation


Example application


Internationalisation


Use

pascal
LazAutoUpdate1.AutoUpdate;
pascal
If LazAutoUpdate1.DownloadInProgress Then
  Begin
  CanClose := False;
  ShowMessage('Please wait. Download is still progress.');
  End;
pascal
LazAutoUpdate1.ShowWhatsNewIfAvailable;

More control

pascal
If LazAutoUpdate1.NewVersionAvailable Then
      MessageDlg(Application.Title, 'A new version of ' + Application.Title +
        ' is available.' + LineEnding +
        'Click ''Check for new version'' in Help menu to update', mtConfirmation,
        [mbOK], 0);
pascal
If LazAutoUpdate1.NewVersionAvailable then ..... else ...
pascal
If LazAutoUpdate1.DownloadNewVersion then ..... else ...
pascal
If LazAutoUpdate1.UpdateToNewVersion then ..... else ...

Debugging

pascal
LazAutoUpdate1.DebugMode:=TRUE;

then you can use the built-in OnDebugEvent method to log activity:

pascal
procedure TForm1.LazAutoUpdate1DebugEvent(Sender: TObject; lauMethodName,
      lauMessage: string);
begin
// Use TEventLog
   Logger.Info('('+lauMethodName+') - ' + lauMessage);
end;

There are also events fired: OnDownloaded and OnNewVersionAvailable and the property LastError with info that you might use for debugging.


Support


License


Deploying your Application with LazAutoUpdate


Using auOtherSourceFilename and auOtherSourceURL


LazAutoUpdate Systray Application


Making a generic online installer/updater

pascal
procedure TForm1.Button1Click(Sender: TObject);
// Uses SysUtils,LazFileUtils,ulazautoupdate etc..
Var sDirectoryToInstallTo: string;
begin
sDirectoryToInstallTo := ProgramDirectory + 'installed';
Application.Title:='My whizzy app'
LazAutoUpdate1.WorkingMode := lauInstall;
LazAutoUpdate1.ProjectType := auSourceForge;
LazAutoUpdate1.SFProjectname:='mywizzy';
LazAutoUpdate1.VersionsININame:='mywizzyapp.ini';
LazAutoUpdate1.ZipfileName:='mywizzyapp.zip';
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo + DirectorySeparator + 'mywizzyapp.exe';
// Our responsibility to make the folder
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion:='0.0.0.0';
If LazAutoUpdate1.DownloadNewVersion then
  begin
    If LazAutoUpdate1.UpdateToNewVersion then
    begin
      LazAutoUpdate1.ShortCut.Category := scUtility;
      LazAutoUpdate1.ShortCut.Target := LazAutoUpdate1.AppFileWithPath;
      LazAutoUpdate1.ShortCut.ShortcutName := Application.Title;
      LazAutoUpdate1.MakeShortCut; // makes a desktop shortcut and a Start menu entry in Windows
    end;
  end;
end;
pascal
// Uses asyncprocess
procedure TForm1.RunInstalledApp;
var
  AProcess: TAsyncProcess;
begin
  if not FileExistsUTF8(LazAutoUpdate1.AppFileWithPath) then
  begin
    ShowMessageFmt('%s does not exist! Install it first.',
      [LazAutoUpdate1.AppFileWithPath]);
    Exit;
  end;
  AProcess := TAsyncProcess.Create(nil);
  try
    AProcess.Executable := LazAutoUpdate1.AppFileWithPath;
    AProcess.Execute;
  finally
    Aprocess.Free;
  end;
end;

Public Methods List


Non-published Properties list


Deploying multiple updates in a single project


In case the download takes to long


Versions.ini

The format is as follows:

text
;LazAutoUpdate versions file
[versions]
GUI=0.0.2

Source Code and latest versions


Security

Windows 10

Linux


Workflow

(Technical explanation)

The Lazarus Auto-Updater workflow for updating a running application is as follows:

The User sees:


Minesadorada


From the Free Pascal wiki, page "LazAutoUpdater", as it stood on 2022-01-07 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .

Edited on wiki.freepascal.org by 5 people, 2014–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
MinesadoradaUpdating a running Lazarus Application (Laz AutoUpdate) Started the page. Work in progress....
MinesadoradaTidy up (minor)
MinesadoradaVersion.xml (minor)
MinesadoradaWorkflow (minor)
MinesadoradaRoadmap to development
MinesadoradaFormatting tidy-up (minor)
MinesadoradaChanged a heading (minor)
MinesadoradaAdded example of application code
MinesadoradaUpdated info - work-in-progress-
MinesadoradaAdded summary section
MinesadoradaAdded sections on how to use and deploy the component
MinesadoradaAdded screenshot; Took out duplicate section
MinesadoradaMoved a section. Corrected a typo
BigChimpInstallation: You cannot install the laz_synapse package, only compile it so Lazarus knows its location.
MinesadoradaAdded info about new properties. Updated screenshot
MinesadoradaCorrected tiepoes
MinesadoradaAdded public methods and properties
MinesadoradaDeploying your Application with LazAutoUpdate
MinesadoradaDeploying your Application with LazAutoUpdate (minor)
MinesadoradaTook out unnecessary code (minor)
MinesadoradaDeploying your Application with LazAutoUpdate (minor)
MinesadoradaUsing auOtherSourceFilename and auOtherSourceURL
MinesadoradaAdded 'Making a generic updater'
MinesadoradaAdded using LazAutoUpdate as a simple installer
MinesadoradaRoadmap: added category (minor)
MinesadoradaLinux functionality ported and tested (minor)
MinesadoradaAdded precautionary about updatehm (minor)
MinesadoradaAdded AutoUpdate method (from v0.0.9) (minor)
MinesadoradaAdded LazAutoUpdate pack Screenshot
MinesadoradaAdded download link (minor)
MinesadoradaAdded update for newer versions of fpc (3.x)
MinesadoradaMinor tweaks (minor)
MinesadoradaUpdate
MinesadoradaTye-poe (minor)
MinesadoradaAdded test about GitHub
MinesadoradaAdded section 'Security'
MinesadoradaTye-poe (minor)
MinesadoradaAnother tye-poe (minor)
MinesadoradaAdded stuff about the example project (minor)
Minesadorada (minor)
MinesadoradaAdded support and licensing info
MinesadoradaAdded to the summary (minor)
MinesadoradaUpdated summary (minor)
MinesadoradaMinor edits (minor)
MinesadoradaTypos etc. (minor)
Minesadorada (minor)
Minesadorada (minor)
Minesadorada (minor)
Minesadorada (minor)
MinesadoradaAdded info about debugging
MinesadoradaAdded public methods
Minesadorada (minor)
MinesadoradaUpdated Debugging section (minor)
MinesadoradaAdded Internationalisation section
MinesadoradaUpdated section
MinesadoradaExpanded generic installer section
Minesadorada (minor)
MinesadoradaAdded code in installer section
Minesadorada (minor)
MinesadoradaInformation about LazAutoupdate Systray companion app
Minesadoradatie-poe (minor)
MinesadoradaMinor additions (minor)
MinesadoradaUpdates SVN checkout URL (minor)
Zoltanleo
Zoltanleo
MinesadoradaFixed syntax highlight errors (minor)
TrevFixed template loop; wiki markup
TrevFix heading levels (minor)
FTurtleAdded page template. Category moved to template for international use.

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.