Fixed binary execute permissions for osx and Radarr

This commit is contained in:
Taloth Saldono 2020-11-22 17:10:29 +01:00
parent 2c76afb839
commit 0bc190e97e
5 changed files with 22 additions and 3 deletions

View File

@ -32,6 +32,7 @@ namespace NzbDrone.Common.Disk
public abstract long? GetAvailableSpace(string path);
public abstract void InheritFolderPermissions(string filename);
public abstract void SetEveryonePermissions(string filename);
public abstract void SetFilePermissions(string path, string mask, string group);
public abstract void SetPermissions(string path, string mask, string group);
public abstract void CopyPermissions(string sourcePath, string targetPath);
public abstract long? GetTotalSize(string path);

View File

@ -11,6 +11,7 @@ namespace NzbDrone.Common.Disk
long? GetAvailableSpace(string path);
void InheritFolderPermissions(string filename);
void SetEveryonePermissions(string filename);
void SetFilePermissions(string path, string mask, string group);
void SetPermissions(string path, string mask, string group);
void CopyPermissions(string sourcePath, string targetPath);
long? GetTotalSize(string path);

View File

@ -66,10 +66,15 @@ namespace NzbDrone.Mono.Disk
}
public override void SetFilePermissions(string path, string mask, string group)
{
var permissions = NativeConvert.FromOctalPermissionString(mask);
SetPermissions(path, mask, group, permissions);
}
public override void SetPermissions(string path, string mask, string group)
{
Logger.Debug("Setting permissions: {0} on {1}", mask, path);
var permissions = NativeConvert.FromOctalPermissionString(mask);
if (File.Exists(path))
@ -77,6 +82,13 @@ namespace NzbDrone.Mono.Disk
permissions = GetFilePermissions(permissions);
}
SetPermissions(path, mask, group, permissions);
}
protected void SetPermissions(string path, string mask, string group, FilePermissions permissions)
{
Logger.Debug("Setting permissions: {0} on {1}", mask, path);
// Preserve non-access permissions
if (Syscall.stat(path, out var curStat) < 0)
{

View File

@ -135,7 +135,7 @@ namespace NzbDrone.Update.UpdateEngine
{
// Old MacOS App stores Sonarr binaries in MacOS together with shell script
// Make shim executable
_diskProvider.SetPermissions(shimPath, "755", null);
_diskProvider.SetFilePermissions(shimPath, "755", null);
}
}
}

View File

@ -88,6 +88,11 @@ namespace NzbDrone.Windows.Disk
}
public override void SetFilePermissions(string path, string mask, string group)
{
}
public override void SetPermissions(string path, string mask, string group)
{