mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 15:10:23 +00:00
Improvements for proxmox connections
This commit is contained in:
parent
b1d8ec2de9
commit
3be6f70272
5 changed files with 21 additions and 6 deletions
|
@ -199,7 +199,7 @@ public class SentryErrorHandler implements ErrorHandler {
|
||||||
options.setProguardUuid(AppProperties.get().getBuildUuid().toString());
|
options.setProguardUuid(AppProperties.get().getBuildUuid().toString());
|
||||||
options.setTag("os", System.getProperty("os.name"));
|
options.setTag("os", System.getProperty("os.name"));
|
||||||
options.setTag("osVersion", System.getProperty("os.version"));
|
options.setTag("osVersion", System.getProperty("os.version"));
|
||||||
options.setTag("arch", System.getProperty("os.arch"));
|
options.setTag("arch", AppProperties.get().getArch());
|
||||||
options.setDist(XPipeDistributionType.get().getId());
|
options.setDist(XPipeDistributionType.get().getId());
|
||||||
options.setTag("staging", String.valueOf(AppProperties.get().isStaging()));
|
options.setTag("staging", String.valueOf(AppProperties.get().isStaging()));
|
||||||
options.setSendModules(false);
|
options.setSendModules(false);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.xpipe.app.util;
|
||||||
|
|
||||||
import io.xpipe.app.issue.ErrorEvent;
|
import io.xpipe.app.issue.ErrorEvent;
|
||||||
import io.xpipe.app.storage.DataStoreEntry;
|
import io.xpipe.app.storage.DataStoreEntry;
|
||||||
|
import io.xpipe.core.process.OsType;
|
||||||
import io.xpipe.core.process.ShellControl;
|
import io.xpipe.core.process.ShellControl;
|
||||||
import io.xpipe.core.util.FailableSupplier;
|
import io.xpipe.core.util.FailableSupplier;
|
||||||
|
|
||||||
|
@ -10,6 +11,15 @@ import java.util.Optional;
|
||||||
|
|
||||||
public class CommandSupport {
|
public class CommandSupport {
|
||||||
|
|
||||||
|
public static boolean isRoot(ShellControl shellControl) throws Exception {
|
||||||
|
if (shellControl.getOsType() == OsType.WINDOWS) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isRoot = shellControl.executeSimpleBooleanCommand("test \"${EUID:-$(id -u)}\" -eq 0");
|
||||||
|
return isRoot;
|
||||||
|
}
|
||||||
|
|
||||||
public static Optional<String> findProgram(ShellControl processControl, String name) throws Exception {
|
public static Optional<String> findProgram(ShellControl processControl, String name) throws Exception {
|
||||||
var out = processControl
|
var out = processControl
|
||||||
.command(processControl.getShellDialect().getWhichCommand(name))
|
.command(processControl.getShellDialect().getWhichCommand(name))
|
||||||
|
|
|
@ -199,6 +199,14 @@ public interface ShellControl extends ProcessControl {
|
||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default ShellControl elevateIfNeeded(ElevationFunction function) throws Exception {
|
||||||
|
if (function.apply(this)) {
|
||||||
|
return identicalSubShell().elevated(ElevationFunction.elevated(function.getPrefix()));
|
||||||
|
} else {
|
||||||
|
return new StubShellControl(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default <T> T enforceDialect(@NonNull ShellDialect type, FailableFunction<ShellControl, T, Exception> sc)
|
default <T> T enforceDialect(@NonNull ShellDialect type, FailableFunction<ShellControl, T, Exception> sc)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
if (isRunning() && getShellDialect().equals(type)) {
|
if (isRunning() && getShellDialect().equals(type)) {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
package io.xpipe.app.ext;
|
package io.xpipe.core.process;
|
||||||
|
|
||||||
import io.xpipe.core.process.ShellControl;
|
|
||||||
|
|
||||||
public class StubShellControl extends WrapperShellControl {
|
public class StubShellControl extends WrapperShellControl {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package io.xpipe.app.ext;
|
package io.xpipe.core.process;
|
||||||
|
|
||||||
import io.xpipe.core.process.*;
|
|
||||||
import io.xpipe.core.store.DataStore;
|
import io.xpipe.core.store.DataStore;
|
||||||
import io.xpipe.core.store.FilePath;
|
import io.xpipe.core.store.FilePath;
|
||||||
import io.xpipe.core.util.FailableConsumer;
|
import io.xpipe.core.util.FailableConsumer;
|
Loading…
Reference in a new issue