Skip to content

Commit

Permalink
Fixed unavailable jar command
Browse files Browse the repository at this point in the history
- prefer unzip, if not detected, use jar

Signed-off-by: David Matějček <[email protected]>
  • Loading branch information
dmatej committed Dec 17, 2024
1 parent 530a422 commit d3b7e03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -194,10 +194,11 @@ private void copyToHostsInternal(File zipFile, ArrayList<String> binDirFiles) th

try {
logger.info("Installing " + getArchiveName() + " into " + host + ":" + sshInstallDir);
String unzipCommand = "cd '" + sshInstallDir + "'; jar -xvf " + getArchiveName();
String unzipCommand = "set -x; cd '" + sshInstallDir
+ "'; unpack=\"$(command -v unzip)\" || unpack=\"jar -xvf\"; ${unpack} " + getArchiveName();
int status = sshLauncher.runCommand(unzipCommand, outStream);
if (status != 0) {
logger.info(Strings.get("jar.failed", host, outStream.toString()));
logger.info(Strings.get("unpack.failed", host, outStream.toString()));
throw new CommandException("Remote command output: " + outStream.toString());
}
if (logger.isLoggable(Level.FINER)) {
Expand All @@ -206,7 +207,7 @@ private void copyToHostsInternal(File zipFile, ArrayList<String> binDirFiles) th
}
}
catch (IOException ioe) {
logger.info(Strings.get("jar.failed", host, outStream.toString()));
logger.info(Strings.get("unpack.failed", host, outStream.toString()));
throw new IOException(ioe);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ PasswordAuthFailure=Failed to authenticate using the aliased password stored in
#installNode
mkdir.failed=Could not create the directory {0} on host {1}
cannot.copy.zip.file=Could not copy zip file {0} to host {1}
jar.failed=jar command failed while installing glassfish on host {0}. Command output {1}
unpack.failed=Failed unpacking glassfish zip file on host {0}. Command output:\n{1}
fix.permissions.failed=Could not set permissions on commands in bin directory on host {0} for glassfish installation {1}
glassfish.install.check.failed=Problem encountered while checking if installation already exists on remote host.

Expand Down

0 comments on commit d3b7e03

Please sign in to comment.