Table of Contents

Class LinuxAppUpdaterProvider

Namespace
VpnHood.AppUi.Hosting.Desktop.Linux
Assembly
VpnHood.AppUi.Hosting.Desktop.Linux.dll

Provides the app's update on Linux, for an install from the website: it hands the package to the installer's own updater, vhupdate, which is the automatic update too.

public sealed class LinuxAppUpdaterProvider : DesktopAppUpdaterProvider, IAppUpdaterProvider
Inheritance
LinuxAppUpdaterProvider
Implements
Inherited Members

Remarks

The timer's runs of vhupdate check the feed; an install here hands vhupdate the downloaded package, whose own update code and version it checks. Here it runs as a transient unit of its own, as a child of the service would go with the service the install stops; its output goes to update.log in the storage folder.

Methods

IsAutomaticUpdateOn(CancellationToken)

Gets whether the updater's timer is on, as the installer left it or the person set it.

public override Task<bool> IsAutomaticUpdateOn(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the timer is enabled.

Exceptions

OperationCanceledException

cancellationToken was canceled.

InvalidOperationException

systemctl could not be run.

RunInstaller(string)

Runs the installer's updater on a package, in a transient unit of its own, and waits for it.

protected override Task<string?> RunInstaller(string packagePath)

Parameters

packagePath string

The package.

Returns

Task<string>

A task whose result is null where the systemd-run process exits with a code above 128, taken as the install stopping this service; else a diagnostic: the update log's last line that is not blank, systemd-run's error output, or a message with its exit code.

Exceptions

InvalidOperationException

systemd-run could not be started.

RunUpdater(CancellationToken)

Asks systemd to start a run of the updater now, through the timer's own unit, as the timer does; a run under way takes the request.

protected override Task RunUpdater(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once systemd has taken the request.

Exceptions

OperationCanceledException

cancellationToken was canceled.

InvalidOperationException

systemctl could not be run, or could not queue the start.

SetAutomaticUpdate(bool, CancellationToken)

Turns the updater's timer on or off at once, as the installer does.

public override Task SetAutomaticUpdate(bool isOn, CancellationToken cancellationToken)

Parameters

isOn bool

true to turn it on.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that represents the asynchronous operation.

Remarks

Turned on, the timer schedules the updater's runs, as its unit sets them.

Exceptions

OperationCanceledException

cancellationToken was canceled.

InvalidOperationException

systemctl could not be run, or could not enable or disable the timer.

TryCreate(AppOptionsContext)

Creates the updater of the install that holds the app's storage folder, /opt/<name>/storage by default: one is there where the storage folder's parent holds a publish.json that names the feed vhupdate reads too.

public static LinuxAppUpdaterProvider? TryCreate(AppOptionsContext context)

Parameters

context AppOptionsContext

The app's options context, with its storage folder and version.

Returns

LinuxAppUpdaterProvider

The updater, or null where there is no such file, as in a debugger's run.

Exceptions

InvalidDataException

The UpdateInfoUrl property in publish.json is null.