From a69593dbdc632eab5824d3130fe9ff1574c1156b Mon Sep 17 00:00:00 2001 From: ShodiBoy1 Date: Mon, 4 May 2026 19:38:15 +0200 Subject: [PATCH] using system tar on macOS to extract .pkg payloads --- CHANGELOG.adoc | 1 + .../com/devonfw/tools/ide/io/FileAccessImpl.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1df58f7626..3378f36f38 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE Release with new features and bugfixes: +* https://github.com/devonfw/IDEasy/issues/796[#796]: Fix `ide ` install on macOS for `.pkg` Payloads in cpio format (e.g. AWS CLI) * https://github.com/devonfw/IDEasy/issues/1833[#1833]: No settings repo update with missing `.commit.id` * https://github.com/devonfw/IDEasy/issues/1693[#1693]: Fix behavior when there's no settings repo (.../settings/.git) * https://github.com/devonfw/IDEasy/issues/1815[#1815]: Suppress Update notification while updating diff --git a/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java b/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java index d34c1a1128..4dbbcd3595 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java +++ b/cli/src/main/java/com/devonfw/tools/ide/io/FileAccessImpl.java @@ -933,15 +933,24 @@ public void extractMsi(Path file, Path targetDir) { public void extractPkg(Path file, Path targetDir) { LOG.info("Extracting PKG file {} to {}", file, targetDir); + assert this.context.getSystemInfo().isMac(); Path tmpDirPkg = createTempDir("ide-pkg-"); ProcessContext pc = this.context.newProcess(); - // we might also be able to use cpio from commons-compression instead of external xar... pc.executable("xar").addArgs("-C", tmpDirPkg, "-xf", file).run(); Path contentPath = findFirst(tmpDirPkg, p -> p.getFileName().toString().equals("Payload"), true); - extractTar(contentPath, targetDir, TarCompression.GZ); + extractPkgPayloadWithSystemTar(contentPath, targetDir); delete(tmpDirPkg); } + private void extractPkgPayloadWithSystemTar(Path payload, Path targetDir) { + + mkdirs(targetDir); + ProcessContext pc = this.context.newProcess(); + pc.executable("/usr/bin/tar"); + pc.addArgs("-xf", payload, "-C", targetDir); + pc.run(); + } + @Override public void compress(Path dir, OutputStream out, String path) {