-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set X-AppImage-Version when creating AppImage #156
Conversation
Program.cs
Outdated
@@ -620,7 +620,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, bool setXAppImageVersion = false, string? version = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the bool
is required. You can just always set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the conditional entirely.
Edit: I'm just unsure if there is any other program that uses this environment variable.
I left the conditional for the case where the version parameter is null.
Edit: maybe the conditional is really unnecessary as theoretically it would not be possible to have a pre-existing VERSION
env var since UseShellExecute
is set to false
. Sorry for the 2 force-pushes.
13f8084
to
e4a3b35
Compare
Program.cs
Outdated
if (version != null) | ||
psi.EnvironmentVariables["VERSION"] = version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this is a little ad-hoc... Sticking this in this generic helper is a little icky.
I'd probably do something like
diff --git a/Program.cs b/Program.cs
index 869914e..1956892 100644
--- a/Program.cs
+++ b/Program.cs
@@ -325,7 +325,11 @@ namespace osu.Desktop.Deploy
// 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
runCommand(appImageToolPath,
- $"\"{stagingTarget}\" -u \"gh-releases-zsync|ppy|osu|latest|osu.AppImage.zsync\" \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\" --sign", false, version);
+ $"\"{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\"");
@@ -620,7 +624,7 @@ namespace osu.Desktop.Deploy
solutionPath = path;
}
- private static bool runCommand(string command, string args, bool useSolutionPath = true, string? version = null)
+ private static bool runCommand(string command, string args, bool useSolutionPath = true, Dictionary<string, string>? environmentVariables = null)
{
write($"Running {command} {args}...");
@@ -634,8 +638,11 @@ namespace osu.Desktop.Deploy
WindowStyle = ProcessWindowStyle.Hidden
};
- if (version != null)
- psi.EnvironmentVariables["VERSION"] = version;
+ 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;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about doing something like that, but since it would be used only one time, I thought it would be better if it was more simple. But I will implement it like that if you prefer it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I basically did the same thing as you. I hope it's fine, but maybe it'd be better if you made the commit since I did almost nothing.
Edit: Sorry, I forgot to add the changes.
e4a3b35
to
40cbe88
Compare
40cbe88
to
43e038f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to set the envvar correctly. @peppy plz check that you're OK with the changes at the code level whenever convenient
Addresses #155.
Uses the
VERSION
environment variable to set aX-AppImage-Version
key for the.desktop
file inside the AppImage.