mirror of https://github.com/Jackett/Jackett
core: fix jackett updater in musl builds (#13439)
This commit is contained in:
parent
fcfa1a9c89
commit
75a2e25528
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
#if ISLINUXMUSL
|
||||
using System.Diagnostics;
|
||||
#endif
|
||||
using Jackett.Common.Services.Interfaces;
|
||||
using Mono.Unix;
|
||||
using NLog;
|
||||
|
@ -16,10 +19,35 @@ namespace Jackett.Server.Services
|
|||
logger.Debug($"Attempting to give execute permission to: {path}");
|
||||
try
|
||||
{
|
||||
#if ISLINUXMUSL
|
||||
// Fix this error in Alpine Linux
|
||||
// Error System.DllNotFoundException: Unable to load shared library 'Mono.Unix' or one of its dependencies.
|
||||
// In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable:
|
||||
// Error loading shared library libMono.Unix: No such file or directory
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
FileName = "chmod",
|
||||
Arguments = $"+x \"{path}\""
|
||||
}
|
||||
};
|
||||
process.Start();
|
||||
var stdErr = process.StandardError.ReadToEnd();
|
||||
process.WaitForExit();
|
||||
if (process.ExitCode != 0)
|
||||
throw new Exception(stdErr);
|
||||
#else
|
||||
var jackettUpdaterFI = new UnixFileInfo(path)
|
||||
{
|
||||
FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute | FileAccessPermissions.GroupRead | FileAccessPermissions.OtherRead
|
||||
FileAccessPermissions = FileAccessPermissions.UserReadWriteExecute | FileAccessPermissions.GroupRead
|
||||
| FileAccessPermissions.OtherRead
|
||||
};
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue