Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updater implement msi installer #7411

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions updater/src/main/java/bisq/updater/linux/DebInstaller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package bisq.updater.linux;

import java.nio.file.Path;

import java.util.List;

import lombok.extern.slf4j.Slf4j;



import bisq.updater.InstallationFailedException;
import bisq.updater.linux.pkexec.PkExec;

@Slf4j
public class DebInstaller {
public static void install(Path debFile) {
log.info("Installing {}", debFile);

var cmd = List.of("dpkg", "--install", debFile.toAbsolutePath().toString());
Process dpkgProcess = PkExec.run(cmd);

int exitCode = dpkgProcess.exitValue();
if (exitCode != 0) {
throw new InstallationFailedException("Deb installation exited with " + exitCode);
}

log.info("Installation finished.");
}
}
29 changes: 29 additions & 0 deletions updater/src/main/java/bisq/updater/linux/RpmInstaller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package bisq.updater.linux;

import java.nio.file.Path;

import java.util.List;

import lombok.extern.slf4j.Slf4j;



import bisq.updater.InstallationFailedException;
import bisq.updater.linux.pkexec.PkExec;

@Slf4j
public class RpmInstaller {
public static void install(Path rpmFile) {
log.info("Installing {}", rpmFile);

var cmd = List.of("rpm", "--upgrade", rpmFile.toAbsolutePath().toString());
Process rpmProcess = PkExec.run(cmd);

int exitCode = rpmProcess.exitValue();
if (exitCode != 0) {
throw new InstallationFailedException("Deb installation exited with " + exitCode);
}

log.info("Installation finished.");
}
}
44 changes: 44 additions & 0 deletions updater/src/main/java/bisq/updater/windows/MsiInstaller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package bisq.updater.windows;

import java.nio.file.Path;

import java.io.IOException;

import java.util.List;
import java.util.concurrent.TimeUnit;

import lombok.extern.slf4j.Slf4j;



import bisq.updater.InstallationFailedException;

@Slf4j
public class MsiInstaller {
public static void install(Path msiFile, Path logFile) {
try {
log.info("Installing {}", msiFile);

var cmd = List.of("msiexec",
"/package", msiFile.toAbsolutePath().toString(),
"/passive",
"/norestart",
"/log", logFile.toAbsolutePath().toString());

Process process = new ProcessBuilder(cmd)
.redirectErrorStream(true)
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.start();

boolean isSuccess = process.waitFor(2, TimeUnit.MINUTES);
if (!isSuccess) {
throw new InstallationFailedException("MSI installation didn't finish after 2 minutes.");
}

} catch (IOException | InterruptedException e) {
throw new InstallationFailedException("MSI installation failed.", e);
} finally {
log.info("Installation finished.");
}
}
}
Loading