Browse Source

Merge pull request #103 from USA-RedDragon/fix-permissions

Unix: Fix binary permissions
pull/118/head
Ionite 1 year ago committed by GitHub
parent
commit
022b79d36b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      StabilityMatrix.Avalonia/Assets.cs
  2. 6
      StabilityMatrix.Avalonia/Program.cs
  3. 6
      StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs

9
StabilityMatrix.Avalonia/Assets.cs

@ -25,6 +25,11 @@ internal static class Assets
public static AvaloniaResource LicensesJson => new( public static AvaloniaResource LicensesJson => new(
"avares://StabilityMatrix.Avalonia/Assets/licenses.json"); "avares://StabilityMatrix.Avalonia/Assets/licenses.json");
private const UnixFileMode unix755 = UnixFileMode.UserRead | UnixFileMode.UserWrite |
UnixFileMode.UserExecute | UnixFileMode.GroupRead |
UnixFileMode.GroupExecute | UnixFileMode.OtherRead |
UnixFileMode.OtherExecute;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]
[SupportedOSPlatform("macos")] [SupportedOSPlatform("macos")]
@ -32,9 +37,9 @@ internal static class Assets
(PlatformKind.Windows, (PlatformKind.Windows,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/win-x64/7za.exe")), new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/win-x64/7za.exe")),
(PlatformKind.Linux | PlatformKind.X64, (PlatformKind.Linux | PlatformKind.X64,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs", (UnixFileMode) 0777)), new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/linux-x64/7zzs", unix755)),
(PlatformKind.MacOS | PlatformKind.Arm, (PlatformKind.MacOS | PlatformKind.Arm,
new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/macos-arm64/7zz", (UnixFileMode) 0x777))); new AvaloniaResource("avares://StabilityMatrix.Avalonia/Assets/macos-arm64/7zz", unix755)));
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]

6
StabilityMatrix.Avalonia/Program.cs

@ -107,7 +107,11 @@ public class Program
// Ensure permissions are set for unix // Ensure permissions are set for unix
if (Compat.IsUnix) if (Compat.IsUnix)
{ {
File.SetUnixFileMode(targetExe, (UnixFileMode) 0x755); File.SetUnixFileMode(targetExe, // 0755
UnixFileMode.UserRead | UnixFileMode.UserWrite |
UnixFileMode.UserExecute | UnixFileMode.GroupRead |
UnixFileMode.GroupExecute | UnixFileMode.OtherRead |
UnixFileMode.OtherExecute);
} }
// Start the new app // Start the new app

6
StabilityMatrix.Avalonia/ViewModels/Dialogs/UpdateViewModel.cs

@ -97,7 +97,11 @@ public partial class UpdateViewModel : ContentDialogViewModelBase
// On unix, we need to set the executable bit // On unix, we need to set the executable bit
if (Compat.IsUnix) if (Compat.IsUnix)
{ {
File.SetUnixFileMode(UpdateHelper.ExecutablePath, (UnixFileMode) 0x755); File.SetUnixFileMode(UpdateHelper.ExecutablePath, // 0755
UnixFileMode.UserRead | UnixFileMode.UserWrite |
UnixFileMode.UserExecute | UnixFileMode.GroupRead |
UnixFileMode.GroupExecute | UnixFileMode.OtherRead |
UnixFileMode.OtherExecute);
} }
UpdateText = "Update complete. Restarting Stability Matrix in 3 seconds..."; UpdateText = "Update complete. Restarting Stability Matrix in 3 seconds...";

Loading…
Cancel
Save