2using System.Globalization;
5using System.Threading.Tasks;
7using Microsoft.Extensions.Logging;
8using Microsoft.Extensions.Options;
63 IOptionsMonitor<GeneralConfiguration> generalConfigurationOptions,
64 ILogger<PosixByondInstaller> logger)
65 : base(ioManager, logger,
fileDownloader, generalConfigurationOptions)
71 Environment.GetFolderPath(
72 Environment.SpecialFolder.UserProfile,
73 Environment.SpecialFolderOption.DoNotVerify),
81 ArgumentNullException.ThrowIfNull(path);
83 return ValueTask.CompletedTask;
89 ArgumentNullException.ThrowIfNull(version);
90 ArgumentNullException.ThrowIfNull(fullDmbPath);
92 Logger.LogTrace(
"No need to trust .dmb path \"{path}\" on POSIX", fullDmbPath);
93 return ValueTask.CompletedTask;
97 protected override ValueTask
InstallImpl(
EngineVersion version,
string path,
bool deploymentPipelineProcesses, CancellationToken cancellationToken)
101 const string StandardScript =
"#!/bin/sh\nexport LD_LIBRARY_PATH=\"\\$ORIGIN:$LD_LIBRARY_PATH\"\nBASEDIR=$(dirname \"$0\")\nexec \"$BASEDIR/{0}\" \"$@\"\n";
106 async ValueTask WriteAndMakeExecutable(
string pathToScript,
string script)
108 Logger.LogTrace(
"Writing script {path}:{newLine}{scriptContents}", pathToScript, Environment.NewLine, script);
115 var ddTask = WriteAndMakeExecutable(
119 var dmTask = WriteAndMakeExecutable(
Information about an engine installation.
Version? Version
The System.Version of the engine. Currently only valid when Engine is EngineType.Byond.
Extension methods for the ValueTask and ValueTask<TResult> classes.
static async ValueTask WhenAll(IEnumerable< ValueTask > tasks)
Fully await a given list of tasks .
Base implementation of IEngineInstaller for EngineType.Byond.
readonly IFileDownloader fileDownloader
The IFileDownloader for the ByondInstallerBase.
const string ByondBinPath
The path to the BYOND bin folder.
void CheckVersionValidity(EngineVersion version)
Check that a given version is of type EngineType.Byond.
IIOManager IOManager
Gets the IIOManager for the EngineInstallerBase.
ILogger< EngineInstallerBase > Logger
Gets the ILogger for the EngineInstallerBase.
IEngineInstaller for Posix systems.
override string OSMarkerTemplate
override ValueTask TrustDmbPath(EngineVersion version, string fullDmbPath, CancellationToken cancellationToken)
Add a given fullDmbPath to the trusted DMBs list in BYOND's config.A ValueTask representing the runn...
const string DreamDaemonExecutableName
The name of the DreamDaemon binary file.
override string DreamMakerName
override ValueTask InstallImpl(EngineVersion version, string path, bool deploymentPipelineProcesses, CancellationToken cancellationToken)
override string PathToUserFolder
readonly IPostWriteHandler postWriteHandler
The IPostWriteHandler for the PosixByondInstaller.
const string DreamMakerExecutableName
The name of the DreamMaker binary file.
const string ShellScriptExtension
File extension for shell scripts.
override string GetDreamDaemonName(Version byondVersion, out bool supportsCli)
PosixByondInstaller(IPostWriteHandler postWriteHandler, IIOManager ioManager, IFileDownloader fileDownloader, IOptionsMonitor< GeneralConfiguration > generalConfigurationOptions, ILogger< PosixByondInstaller > logger)
Initializes a new instance of the PosixByondInstaller class.
override ValueTask UpgradeInstallation(EngineVersion version, string path, CancellationToken cancellationToken)
Does actions necessary to get upgrade a version installed by a previous version of TGS....
Interface for using filesystems.
string ResolvePath()
Retrieve the full path of the current working directory.
string ConcatPath(params string[] paths)
Combines an array of strings into a path.
ValueTask WriteAllBytes(string path, byte[] contents, CancellationToken cancellationToken)
Writes some contents to a file at path overwriting previous content.
Handles changing file modes/permissions after writing.
void HandleWrite(string filePath)
For handling system specific necessities after a write.