diff --git a/Pilz.Updating.Client/Pilz.Updating.Client.csproj b/Pilz.Updating.Client/Pilz.Updating.Client.csproj
index 17cb2ba..50ce849 100644
--- a/Pilz.Updating.Client/Pilz.Updating.Client.csproj
+++ b/Pilz.Updating.Client/Pilz.Updating.Client.csproj
@@ -8,7 +8,7 @@
- 4.4.0
+ 4.4.3
diff --git a/Pilz.Updating.Client/UpdateClient.cs b/Pilz.Updating.Client/UpdateClient.cs
index 6905d3e..1702bd1 100644
--- a/Pilz.Updating.Client/UpdateClient.cs
+++ b/Pilz.Updating.Client/UpdateClient.cs
@@ -1,4 +1,6 @@
-using System.IO.Compression;
+using System.Diagnostics;
+using System.IO.Compression;
+using Pilz.Runtime;
namespace Pilz.Updating.Client;
@@ -26,6 +28,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
public bool UIDarkMode { get; set; }
public bool HasUpdates => UpdatePackageInfo != null;
public string? Distro { get; set; }
+ public bool MakeAppBinaryExecutable { get; set; } = RuntimeInformationsEx.OSType == OSType.Linux || RuntimeInformationsEx.OSType == OSType.Windows;
// E v e n t M e t h o d s
@@ -193,8 +196,27 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
Utils.CopyFiles(dataPathDir, destDir);
}
else if (package.UpdateType == UpdateType.File)
- Utils.CopyFile(new FileInfo(dataPath), new FileInfo(localInstallPath));
+ {
+ if (packageSource.PackageType == PackageType.File)
+ Utils.CopyFile(new FileInfo(dataPath), new FileInfo(localInstallPath));
+ else if (Directory.GetFiles(dataPath).FirstOrDefault() is { } firstFile)
+ Utils.CopyFile(new FileInfo(firstFile), new FileInfo(localInstallPath));
+ }
RaiseStatusChanged(UpdateStatus.Copying, UpdateStatusEvent.PostEvent);
+
+ // Make executable
+ if (MakeAppBinaryExecutable)
+ {
+ switch (package.UpdateType)
+ {
+ case UpdateType.File:
+ Utils.MakeExecutable(localInstallPath);
+ break;
+ case UpdateType.Folder when !string.IsNullOrWhiteSpace(package.ExePath):
+ Utils.MakeExecutable(Path.Combine(localInstallPath, package.ExePath));
+ break;
+ }
+ }
// Delete Package
RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PreEvent);
diff --git a/Pilz.Updating.Client/Utils.cs b/Pilz.Updating.Client/Utils.cs
index 8d9e657..57bec67 100644
--- a/Pilz.Updating.Client/Utils.cs
+++ b/Pilz.Updating.Client/Utils.cs
@@ -1,4 +1,5 @@
-using System.Runtime.InteropServices;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
using Pilz.Runtime;
namespace Pilz.Updating.Client;
@@ -68,4 +69,21 @@ public static class Utils
}
}
}
+
+ public static void MakeExecutable(string filePath)
+ {
+ var pChmod = new Process
+ {
+ StartInfo = new ProcessStartInfo
+ {
+ FileName = "chmod",
+ Arguments = $"+x \"{filePath}\"",
+ RedirectStandardOutput = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ },
+ };
+ pChmod.Start();
+ pChmod.WaitForExit();
+ }
}