2using System.Globalization;
5using System.Threading.Tasks;
7using Microsoft.Extensions.Logging;
60 ILogger<PosixByondInstaller> logger)
67 Environment.GetFolderPath(
68 Environment.SpecialFolder.UserProfile,
69 Environment.SpecialFolderOption.DoNotVerify),
74 public override ValueTask
Install(
EngineVersion version,
string path,
bool deploymentPipelineProcesses, CancellationToken cancellationToken)
77 ArgumentNullException.ThrowIfNull(path);
81 const string StandardScript =
"#!/bin/sh\nexport LD_LIBRARY_PATH=\"\\$ORIGIN:$LD_LIBRARY_PATH\"\nBASEDIR=$(dirname \"$0\")\nexec \"$BASEDIR/{0}\" \"$@\"\n";
86 async ValueTask WriteAndMakeExecutable(
string pathToScript,
string script)
88 Logger.LogTrace(
"Writing script {path}:{newLine}{scriptContents}", pathToScript, Environment.NewLine, script);
95 var ddTask = WriteAndMakeExecutable(
99 var dmTask = WriteAndMakeExecutable(
117 ArgumentNullException.ThrowIfNull(path);
119 return ValueTask.CompletedTask;
125 ArgumentNullException.ThrowIfNull(version);
126 ArgumentNullException.ThrowIfNull(fullDmbPath);
128 Logger.LogTrace(
"No need to trust .dmb path \"{path}\" on POSIX", fullDmbPath);
129 return ValueTask.CompletedTask;
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 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 string PathToUserFolder
readonly IPostWriteHandler postWriteHandler
The IPostWriteHandler for the PosixByondInstaller.
override string ByondRevisionsUrlTemplate
PosixByondInstaller(IPostWriteHandler postWriteHandler, IIOManager ioManager, IFileDownloader fileDownloader, ILogger< PosixByondInstaller > logger)
Initializes a new instance of the PosixByondInstaller class.
const string DreamMakerExecutableName
The name of the DreamMaker binary file.
override ValueTask Install(EngineVersion version, string path, bool deploymentPipelineProcesses, CancellationToken cancellationToken)
Does actions necessary to get an extracted installation working.A ValueTask representing the running ...
const string ShellScriptExtension
File extension for shell scripts.
override string GetDreamDaemonName(Version byondVersion, out bool supportsCli)
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.