Fixed binary execute permissions for osx and Radarr

Fixes #5388

Co-Authored-By: Taloth <Taloth@users.noreply.github.com>
pull/5323/head
Qstick 4 years ago
parent 28e2834c5d
commit e3ac7d6fc5

@ -30,6 +30,7 @@ namespace NzbDrone.Common.Disk
public abstract long? GetAvailableSpace(string path); public abstract long? GetAvailableSpace(string path);
public abstract void InheritFolderPermissions(string filename); public abstract void InheritFolderPermissions(string filename);
public abstract void SetEveryonePermissions(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 SetPermissions(string path, string mask, string group);
public abstract void CopyPermissions(string sourcePath, string targetPath); public abstract void CopyPermissions(string sourcePath, string targetPath);
public abstract long? GetTotalSize(string path); public abstract long? GetTotalSize(string path);

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

@ -61,10 +61,15 @@ namespace NzbDrone.Mono.Disk
{ {
} }
public override void SetPermissions(string path, string mask, string group) public override void SetFilePermissions(string path, string mask, string group)
{ {
_logger.Debug("Setting permissions: {0} on {1}", mask, path); var permissions = NativeConvert.FromOctalPermissionString(mask);
SetPermissions(path, mask, group, permissions);
}
public override void SetPermissions(string path, string mask, string group)
{
var permissions = NativeConvert.FromOctalPermissionString(mask); var permissions = NativeConvert.FromOctalPermissionString(mask);
if (File.Exists(path)) if (File.Exists(path))
@ -72,6 +77,13 @@ namespace NzbDrone.Mono.Disk
permissions = GetFilePermissions(permissions); 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 // Preserve non-access permissions
if (Syscall.stat(path, out var curStat) < 0) if (Syscall.stat(path, out var curStat) < 0)
{ {

@ -131,7 +131,7 @@ namespace NzbDrone.Update.UpdateEngine
// Set executable flag on app // Set executable flag on app
if (OsInfo.IsOsx || (OsInfo.IsLinux && PlatformInfo.IsNetCore)) if (OsInfo.IsOsx || (OsInfo.IsLinux && PlatformInfo.IsNetCore))
{ {
_diskProvider.SetPermissions(Path.Combine(installationFolder, "Radarr"), "755", null); _diskProvider.SetFilePermissions(Path.Combine(installationFolder, "Radarr"), "755", null);
} }
} }
catch (Exception e) catch (Exception e)

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

Loading…
Cancel
Save