Fixes [stage]

This commit is contained in:
crschnick
2025-04-12 19:33:43 +00:00
parent bfe6baee74
commit 322faf247e
3 changed files with 27 additions and 10 deletions

View File

@@ -7,6 +7,7 @@ import io.xpipe.app.util.LocalExec;
import io.xpipe.app.util.Translatable;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellScript;
import io.xpipe.core.util.XPipeInstallation;
import javafx.beans.value.ObservableValue;
@@ -24,17 +25,32 @@ public enum AppDistributionType implements Translatable {
PORTABLE("portable", false, () -> new PortableUpdater(true)),
NATIVE_INSTALLATION("install", true, () -> new GitHubUpdater(true)),
HOMEBREW("homebrew", true, () -> {
return new CommandUpdater(CommandBuilder.of().add("brew", "upgrade", "--cask", AppProperties.get().isStaging() ? "xpipe-io/pbb/xpipe-ptb" : "xpipe-io/tap/xpipe"));
return new CommandUpdater(ShellScript.lines("brew upgrade --cask " + (AppProperties.get().isStaging() ? "xpipe-io/ptb/xpipe-ptb" : "xpipe-io/tap/xpipe")));
}),
APT_REPO("apt", true, () -> {
return new CommandUpdater(CommandBuilder.of().add("sudo", "apt", "update", "&&", "sudo", "apt", "install", AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"));
return new CommandUpdater(ShellScript.lines(
"+ sudo apt update && sudo apt install " + (AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"),
"sudo apt update",
"sudo apt install " + (AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe")
));
}),
RPM_REPO("rpm", true, () -> {
return new CommandUpdater(CommandBuilder.of().add("sudo", "yum", "upgrade", AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe", "--refresh"));
return new CommandUpdater(ShellScript.lines(
"+ sudo yum upgrade " + (AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe") + " --refresh",
"sudo yum upgrade " + (AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe") + " --refresh"
));
}),
WEBTOP("webtop", true, () -> new WebtopUpdater()),
CHOCO("choco", true, () -> {
return new CommandUpdater(CommandBuilder.of().add("choco", "upgrade", AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"));
var systemWide = Files.exists(XPipeInstallation.getCurrentInstallationBasePath().resolve("system"));
var pkg = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe";
if (systemWide) {
return new CommandUpdater(ShellScript.lines(
"powershell -Command \"Start-Process -Verb runAs -FilePath choco -ArgumentList upgrade, " + pkg + "\""
));
} else {
return new CommandUpdater(ShellScript.lines("choco upgrade " + pkg));
}
});
private static AppDistributionType type;
@@ -60,7 +76,7 @@ public enum AppDistributionType implements Translatable {
}
if (!AppProperties.get().isImage()) {
type = DEVELOPMENT;
type = CHOCO;
return;
}

View File

@@ -9,6 +9,7 @@ import io.xpipe.app.util.DocumentationLink;
import io.xpipe.app.util.Hyperlinks;
import io.xpipe.app.util.LocalShell;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellScript;
import java.nio.file.Files;
import java.util.ArrayList;
@@ -16,11 +17,11 @@ import java.util.List;
public class CommandUpdater extends PortableUpdater {
private final CommandBuilder command;
private final ShellScript script;
public CommandUpdater(CommandBuilder command) {
public CommandUpdater(ShellScript script) {
super(true);
this.command = command;
this.script = script;
}
@Override
@@ -60,7 +61,7 @@ public class CommandUpdater extends PortableUpdater {
var performedUpdate = new PerformedUpdate(p.getVersion(), p.getBody(), p.getVersion());
AppCache.update("performedUpdate", performedUpdate);
OperationMode.executeAfterShutdown(() -> {
TerminalLauncher.openDirect("Update", command);
TerminalLauncher.openDirect("XPipe Updater", script);
});
} catch (Throwable t) {
ErrorEvent.fromThrowable(t).handle();

View File

@@ -1 +1 @@
16.0-30
16.0-31