Merge branch 'allusers'

This commit is contained in:
crschnick 2024-11-19 15:04:20 +00:00
parent 4693213589
commit 7975a735ef
8 changed files with 39 additions and 19 deletions

View file

@ -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)
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"

View file

@ -67,7 +67,7 @@ dependencies {
api group: 'org.kordamp.ikonli', name: 'ikonli-feather-pack', version: "12.2.0"
api group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16'
api group: 'org.slf4j', name: 'slf4j-jdk-platform-logging', version: '2.0.16'
api 'io.xpipe:modulefs:0.1.5'
api 'io.xpipe:modulefs:0.1.6'
api 'net.synedra:validatorfx:0.4.2'
api files("$rootDir/gradle/gradle_scripts/atlantafx-base-2.0.2.jar")
}

View file

@ -3,6 +3,7 @@ package io.xpipe.app.update;
import io.xpipe.app.core.AppLogs;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.ext.ProcessControlProvider;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.terminal.ExternalTerminalType;
import io.xpipe.app.terminal.TerminalLauncher;
@ -87,14 +88,19 @@ public class AppInstaller {
AppLogs.get().getSessionLogsDirectory().getParent().toString();
var logFile = FileNames.join(
logsDir, "installer_" + file.getFileName().toString() + ".log");
var systemWide = isSystemWide();
var command = LocalShell.getShell().getShellDialect().equals(ShellDialects.CMD)
? getCmdCommand(file.toString(), logFile, exec)
: getPowershellCommand(file.toString(), logFile, exec);
var toRun = LocalShell.getShell().getShellDialect().equals(ShellDialects.CMD)
? "start \"XPipe Updater\" /min cmd /c \"" + ScriptHelper.createLocalExecScript(command) + "\""
: "Start-Process -WindowStyle Minimized -FilePath powershell -ArgumentList \"-ExecutionPolicy\", \"Bypass\", \"-File\", \"`\""
+ ScriptHelper.createLocalExecScript(command) + "`\"\"";
? getCmdCommand(file.toString(), logFile, exec, systemWide)
: getPowershellCommand(file.toString(), logFile, exec, systemWide);
String toRun;
if (ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD) {
toRun = systemWide ? "powershell -Command Start-Process -Verb runAs -WindowStyle Minimized -FilePath cmd -ArgumentList \"/c\", '\""
+ 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(() -> {
LocalShell.getShell().executeSimpleCommand(toRun);
});
@ -105,32 +111,38 @@ public class AppInstaller {
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(
"""
echo Installing %s ...
cd /D "%%HOMEDRIVE%%%%HOMEPATH%%"
echo + msiexec /i "%s" /lv "%s" /qr
start "" /wait msiexec /i "%s" /lv "%s" /qb
echo + msiexec /i "%s" /lv "%s" /qb %s
start "" /wait msiexec /i "%s" /lv "%s" /qb %s
echo Starting XPipe ...
echo + "%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(
"""
echo Installing %s ...
cd "$env:HOMEDRIVE\\$env:HOMEPATH"
echo '+ msiexec /i "%s" /lv "%s" /qr'
Start-Process msiexec -Wait -ArgumentList "/i", "`"%s`"", "/lv", "`"%s`"", "/qb"
echo '+ msiexec /i "%s" /lv "%s" /qb %s'
Start-Process msiexec -Wait -ArgumentList "/i", "`"%s`"", "/lv", "`"%s`"", "/qb", %s
echo 'Starting XPipe ...'
echo '+ "%s"'
Start-Process -FilePath "%s"
""",
file, file, logFile, file, logFile, exec, exec);
file, file, logFile, args, file, logFile, args, exec, exec);
}
}

View file

@ -134,6 +134,7 @@ project.ext {
"--add-opens", "net.synedra.validatorfx/net.synedra.validatorfx=io.xpipe.app",
"--add-opens", "java.base/java.nio.file=io.xpipe.app",
"--add-exports", "javafx.graphics/com.sun.javafx.tk=io.xpipe.app",
"--add-exports", "jdk.zipfs/jdk.nio.zipfs=io.xpipe.modulefs",
"--add-opens", "javafx.graphics/com.sun.glass.ui=io.xpipe.app",
"--add-opens", "javafx.graphics/javafx.stage=io.xpipe.app",
"--add-opens", "javafx.graphics/com.sun.javafx.tk.quantum=io.xpipe.app",

View file

@ -259,6 +259,12 @@ public class XPipeInstallation {
public static String getLocalDefaultInstallationBasePath(boolean stage) {
String path;
if (OsType.getLocal().equals(OsType.WINDOWS)) {
var pg = System.getenv("ProgramFiles");
var systemPath = Path.of(pg,stage ? "XPipe PTB" : "XPipe");
if (Files.exists(systemPath)) {
return systemPath.toString();
}
var base = System.getenv("LOCALAPPDATA");
path = FileNames.join(base, stage ? "XPipe PTB" : "XPipe");
} else if (OsType.getLocal().equals(OsType.LINUX)) {

View file

@ -1,3 +1,4 @@
- Rework Windows msi installer to support both per-user and system-wide installations. The installer will also now respect the properties `ALLUSERS`
- Add pin tab button to the file browser menu bar to make tab splitting more prominent
- Add file browser setting to automatically start up with local machine tab pinned
- Add download context menu action in file browser as an alternative to dragging files to the download box

View file

@ -100,7 +100,7 @@ function Uninstall {
param()
# Quick heuristic to see whether is can be possibly installed
if (-not (Test-Path "$env:LOCALAPPDATA\$ProductName" -PathType Container)) {
if (-not ((Test-Path "$env:LOCALAPPDATA\$ProductName" -PathType Container) -or (Test-Path "$env:ProgramFiles\$ProductName" -PathType Container))) {
return
}

View file

@ -1 +1 @@
13.1
13.1-1