Fix for sh shells

This commit is contained in:
crschnick 2024-08-29 01:23:39 +00:00
parent 4f2ccea254
commit ec258a1eaa
3 changed files with 24 additions and 4 deletions

View file

@ -3,9 +3,17 @@ package io.xpipe.app.prefs;
import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.impl.StackComp;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStorageSyncHandler;
import io.xpipe.app.util.DesktopHelper; import io.xpipe.app.util.DesktopHelper;
import io.xpipe.app.util.OptionsBuilder; import io.xpipe.app.util.OptionsBuilder;
import io.xpipe.app.util.ThreadHelper;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
public class SyncCategory extends AppPrefsCategory { public class SyncCategory extends AppPrefsCategory {
@ -16,6 +24,14 @@ public class SyncCategory extends AppPrefsCategory {
public Comp<?> create() { public Comp<?> create() {
var prefs = AppPrefs.get(); var prefs = AppPrefs.get();
var terminalTest = new StackComp(
List.of(new ButtonComp(AppI18n.observable("test"), new FontIcon("mdi2p-play"), () -> {
ThreadHelper.runAsync(() -> {
DataStorageSyncHandler.getInstance().validateConnection();
});
}).padding(new Insets(6, 10, 6, 6))))
.padding(new Insets(10, 0, 0, 0))
.apply(struc -> struc.get().setAlignment(Pos.CENTER_LEFT));
var builder = new OptionsBuilder(); var builder = new OptionsBuilder();
builder.addTitle("sync") builder.addTitle("sync")
.sub(new OptionsBuilder() .sub(new OptionsBuilder()
@ -23,8 +39,10 @@ public class SyncCategory extends AppPrefsCategory {
.description("enableGitStorageDescription") .description("enableGitStorageDescription")
.addToggle(prefs.enableGitStorage) .addToggle(prefs.enableGitStorage)
.nameAndDescription("storageGitRemote") .nameAndDescription("storageGitRemote")
.addString(prefs.storageGitRemote, true) .addString(prefs.storageGitRemote)
.disable(prefs.enableGitStorage.not()) .disable(prefs.enableGitStorage.not())
.addComp(terminalTest)
.disable(prefs.storageGitRemote.isNull().and(prefs.enableGitStorage))
.addComp(prefs.getCustomComp("gitVaultIdentityStrategy")) .addComp(prefs.getCustomComp("gitVaultIdentityStrategy"))
.nameAndDescription("openDataDir") .nameAndDescription("openDataDir")
.addComp(new ButtonComp(AppI18n.observable("openDataDirButton"), () -> { .addComp(new ButtonComp(AppI18n.observable("openDataDirButton"), () -> {

View file

@ -10,6 +10,8 @@ public interface DataStorageSyncHandler {
return (DataStorageSyncHandler) ProcessControlProvider.get().getGitStorageHandler(); return (DataStorageSyncHandler) ProcessControlProvider.get().getGitStorageHandler();
} }
void validateConnection();
boolean supportsSync(); boolean supportsSync();
void init(); void init();

View file

@ -151,7 +151,7 @@ public class AppInstaller {
var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"; var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe";
var command = String.format( var command = String.format(
""" """
function exec { exec() {
echo "Installing downloaded .deb installer ..." echo "Installing downloaded .deb installer ..."
echo "+ sudo apt install \\"%s\\"" echo "+ sudo apt install \\"%s\\""
DEBIAN_FRONTEND=noninteractive sudo apt-get install -qy "%s" || return 1 DEBIAN_FRONTEND=noninteractive sudo apt-get install -qy "%s" || return 1
@ -191,7 +191,7 @@ public class AppInstaller {
var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"; var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe";
var command = String.format( var command = String.format(
""" """
function exec { exec() {
echo "Installing downloaded .rpm installer ..." echo "Installing downloaded .rpm installer ..."
echo "+ sudo rpm -U -v --force \\"%s\\"" echo "+ sudo rpm -U -v --force \\"%s\\""
sudo rpm -U -v --force "%s" || return 1 sudo rpm -U -v --force "%s" || return 1
@ -231,7 +231,7 @@ public class AppInstaller {
var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe"; var name = AppProperties.get().isStaging() ? "xpipe-ptb" : "xpipe";
var command = String.format( var command = String.format(
""" """
function exec { exec() {
echo "Installing downloaded .pkg installer ..." echo "Installing downloaded .pkg installer ..."
echo "+ sudo installer -verboseR -allowUntrusted -pkg \\"%s\\" -target /" echo "+ sudo installer -verboseR -allowUntrusted -pkg \\"%s\\" -target /"
sudo installer -verboseR -allowUntrusted -pkg "%s" -target / || return 1 sudo installer -verboseR -allowUntrusted -pkg "%s" -target / || return 1