Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Tom Hochstein <tom.hochstein@nxp.com>
To: openembedded-core@lists.openembedded.org
Cc: Tom Hochstein <tom.hochstein@nxp.com>
Subject: [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file'
Date: Sat, 16 Mar 2024 12:35:58 -0500	[thread overview]
Message-ID: <20240316173558.468284-1-tom.hochstein@nxp.com> (raw)

On a machine without the file command, the SDK install fails with a
cryptic error message.

```
xargs: file: No such file or directory
sed: no input files
Failed to replace perl. Relocate script failed. Abort!
```

Add a test for 'file' to print a clear error message.

```
The command 'file' is required by the relocation script, please install it first. Abort!
```

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 meta/files/toolchain-shar-relocate.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index e8ab357717..3d55e38102 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -1,7 +1,9 @@
-if ! xargs --version > /dev/null 2>&1; then
-	echo "xargs is required by the relocation script, please install it first. Abort!"
-	exit 1
-fi
+for cmd in xargs file; do
+	if ! command -v $cmd &> /dev/null; then
+		echo "The command '$cmd' is required by the relocation script, please install it first. Abort!"
+		exit 1
+	fi
+done
 
 # fix dynamic loader paths in all ELF SDK binaries
 # allow symlinks to be accessed via the find command too
-- 
2.25.1



             reply	other threads:[~2024-03-16 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16 17:35 Tom Hochstein [this message]
2024-03-21 15:19 ` [OE-core] [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file' Alexandre Belloni
2024-03-21 17:30   ` Tom Hochstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240316173558.468284-1-tom.hochstein@nxp.com \
    --to=tom.hochstein@nxp.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox