mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 09:00:26 +00:00
Fixes
This commit is contained in:
parent
7577ce9c1a
commit
800ba6f042
2 changed files with 28 additions and 16 deletions
|
@ -93,7 +93,7 @@ Installers are the easiest way to get started and come with an optional automati
|
||||||
|
|
||||||
- [Windows .msi Installer (x86-64)](https://github.com/xpipe-io/xpipe/releases/latest/download/xpipe-installer-windows-x86_64.msi)
|
- [Windows .msi Installer (x86-64)](https://github.com/xpipe-io/xpipe/releases/latest/download/xpipe-installer-windows-x86_64.msi)
|
||||||
|
|
||||||
You can also install XPipe by pasting the installation command into your terminal. This will perform the .msi setup automatically:
|
You can also install XPipe by pasting the installation command into your terminal. This will perform the .msi setup for the current user automatically:
|
||||||
|
|
||||||
```
|
```
|
||||||
powershell -ExecutionPolicy Bypass -Command iwr "https://github.com/xpipe-io/xpipe/raw/master/get-xpipe.ps1" -OutFile "$env:TEMP\get-xpipe.ps1" ";" "&" "$env:TEMP\get-xpipe.ps1"
|
powershell -ExecutionPolicy Bypass -Command iwr "https://github.com/xpipe-io/xpipe/raw/master/get-xpipe.ps1" -OutFile "$env:TEMP\get-xpipe.ps1" ";" "&" "$env:TEMP\get-xpipe.ps1"
|
||||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.update;
|
||||||
import io.xpipe.app.core.AppLogs;
|
import io.xpipe.app.core.AppLogs;
|
||||||
import io.xpipe.app.core.AppProperties;
|
import io.xpipe.app.core.AppProperties;
|
||||||
import io.xpipe.app.core.mode.OperationMode;
|
import io.xpipe.app.core.mode.OperationMode;
|
||||||
|
import io.xpipe.app.ext.ProcessControlProvider;
|
||||||
import io.xpipe.app.prefs.AppPrefs;
|
import io.xpipe.app.prefs.AppPrefs;
|
||||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||||
import io.xpipe.app.terminal.TerminalLauncher;
|
import io.xpipe.app.terminal.TerminalLauncher;
|
||||||
|
@ -87,14 +88,19 @@ public class AppInstaller {
|
||||||
AppLogs.get().getSessionLogsDirectory().getParent().toString();
|
AppLogs.get().getSessionLogsDirectory().getParent().toString();
|
||||||
var logFile = FileNames.join(
|
var logFile = FileNames.join(
|
||||||
logsDir, "installer_" + file.getFileName().toString() + ".log");
|
logsDir, "installer_" + file.getFileName().toString() + ".log");
|
||||||
|
var systemWide = isSystemWide();
|
||||||
var command = LocalShell.getShell().getShellDialect().equals(ShellDialects.CMD)
|
var command = LocalShell.getShell().getShellDialect().equals(ShellDialects.CMD)
|
||||||
? getCmdCommand(file.toString(), logFile, exec)
|
? getCmdCommand(file.toString(), logFile, exec, systemWide)
|
||||||
: getPowershellCommand(file.toString(), logFile, exec);
|
: getPowershellCommand(file.toString(), logFile, exec, systemWide);
|
||||||
var toRun = LocalShell.getShell().getShellDialect().equals(ShellDialects.CMD)
|
String toRun;
|
||||||
? "start \"XPipe Updater\" /min cmd /c \"" + ScriptHelper.createLocalExecScript(command) + "\""
|
if (ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD) {
|
||||||
: "Start-Process -WindowStyle Minimized -FilePath powershell -ArgumentList \"-ExecutionPolicy\", \"Bypass\", \"-File\", \"`\""
|
toRun = systemWide ? "powershell -Command Start-Process -Verb runAs -WindowStyle Minimized -FilePath cmd -ArgumentList \"/c\", '\""
|
||||||
+ ScriptHelper.createLocalExecScript(command) + "`\"\"";
|
+ ScriptHelper.createLocalExecScript(command) + "\"'" :
|
||||||
|
"start \"XPipe Updater\" /min cmd /c \"" + ScriptHelper.createLocalExecScript(command) + "\"";
|
||||||
|
} else {
|
||||||
|
toRun = "Start-Process -WindowStyle Minimized -FilePath powershell -ArgumentList \"-ExecutionPolicy\", \"Bypass\", \"-File\", \"`\""
|
||||||
|
+ ScriptHelper.createLocalExecScript(command) + "`\"\"" + (systemWide ? " -Verb runAs" : "");
|
||||||
|
}
|
||||||
runAndClose(() -> {
|
runAndClose(() -> {
|
||||||
LocalShell.getShell().executeSimpleCommand(toRun);
|
LocalShell.getShell().executeSimpleCommand(toRun);
|
||||||
});
|
});
|
||||||
|
@ -105,32 +111,38 @@ public class AppInstaller {
|
||||||
return ".msi";
|
return ".msi";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCmdCommand(String file, String logFile, String exec) {
|
private boolean isSystemWide() {
|
||||||
|
return Files.exists(XPipeInstallation.getCurrentInstallationBasePath().resolve("system"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCmdCommand(String file, String logFile, String exec, boolean systemWide) {
|
||||||
|
var args = systemWide ? "ALLUSERS=1" : "";
|
||||||
return String.format(
|
return String.format(
|
||||||
"""
|
"""
|
||||||
echo Installing %s ...
|
echo Installing %s ...
|
||||||
cd /D "%%HOMEDRIVE%%%%HOMEPATH%%"
|
cd /D "%%HOMEDRIVE%%%%HOMEPATH%%"
|
||||||
echo + msiexec /i "%s" /lv "%s" /qr
|
echo + msiexec /i "%s" /lv "%s" /qb %s
|
||||||
start "" /wait msiexec /i "%s" /lv "%s" /qb
|
start "" /wait msiexec /i "%s" /lv "%s" /qb %s
|
||||||
echo Starting XPipe ...
|
echo Starting XPipe ...
|
||||||
echo + "%s"
|
echo + "%s"
|
||||||
start "" "%s"
|
start "" "%s"
|
||||||
""",
|
""",
|
||||||
file, file, logFile, file, logFile, exec, exec);
|
file, file, logFile, args, file, logFile, args, exec, exec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPowershellCommand(String file, String logFile, String exec) {
|
private String getPowershellCommand(String file, String logFile, String exec, boolean systemWide) {
|
||||||
|
var args = systemWide ? "ALLUSERS=1" : "";
|
||||||
return String.format(
|
return String.format(
|
||||||
"""
|
"""
|
||||||
echo Installing %s ...
|
echo Installing %s ...
|
||||||
cd "$env:HOMEDRIVE\\$env:HOMEPATH"
|
cd "$env:HOMEDRIVE\\$env:HOMEPATH"
|
||||||
echo '+ msiexec /i "%s" /lv "%s" /qr'
|
echo '+ msiexec /i "%s" /lv "%s" /qb %s'
|
||||||
Start-Process msiexec -Wait -ArgumentList "/i", "`"%s`"", "/lv", "`"%s`"", "/qb"
|
Start-Process msiexec -Wait -ArgumentList "/i", "`"%s`"", "/lv", "`"%s`"", "/qb", %s
|
||||||
echo 'Starting XPipe ...'
|
echo 'Starting XPipe ...'
|
||||||
echo '+ "%s"'
|
echo '+ "%s"'
|
||||||
Start-Process -FilePath "%s"
|
Start-Process -FilePath "%s"
|
||||||
""",
|
""",
|
||||||
file, file, logFile, file, logFile, exec, exec);
|
file, file, logFile, args, file, logFile, args, exec, exec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue