Skip to content

Commit

Permalink
Set X-AppImage-Version when creating AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemarins committed Jan 11, 2024
1 parent a935e27 commit 43e038f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,14 @@ public static void Main(string[] args)
// ppy|osu|latest stands for https://github.com/ppy/osu and get the latest release
// osu.AppImage.zsync is AppImage update information file, that is generated by the tool
// more information there https://docs.appimage.org/packaging-guide/optional/updates.html?highlight=update#using-appimagetool
// also sets a VERSION environment variable that creates a X-AppImage-Version key in the .desktop file inside the AppImage
// for information about this key: https://docs.appimage.org/reference/desktop-integration.html#custom-keys-introduced-for-appimage-purposes
runCommand(appImageToolPath,
$"\"{stagingTarget}\" -u \"gh-releases-zsync|ppy|osu|latest|osu.AppImage.zsync\" \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\" --sign", false);
$"\"{stagingTarget}\" -u \"gh-releases-zsync|ppy|osu|latest|osu.AppImage.zsync\" \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\" --sign", false,
new Dictionary<string, string>
{
["VERSION"] = version
});

// mark finally the osu! AppImage as executable -> Don't compress it.
runCommand("chmod", $"+x \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\"");
Expand Down Expand Up @@ -620,7 +626,7 @@ private static void findSolutionPath()
solutionPath = path;
}

private static bool runCommand(string command, string args, bool useSolutionPath = true)
private static bool runCommand(string command, string args, bool useSolutionPath = true, Dictionary<string, string>? environmentVariables = null)
{
write($"Running {command} {args}...");

Expand All @@ -634,6 +640,12 @@ private static bool runCommand(string command, string args, bool useSolutionPath
WindowStyle = ProcessWindowStyle.Hidden
};

if (environmentVariables != null)
{
foreach (var pair in environmentVariables)
psi.EnvironmentVariables.Add(pair.Key, pair.Value);
}

Process? p = Process.Start(psi);
if (p == null) return false;

Expand Down

0 comments on commit 43e038f

Please sign in to comment.