]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
toolchain-shar-relocate.sh: Add check for missing command 'file'
authorTom Hochstein <tom.hochstein@nxp.com>
Thu, 21 Mar 2024 17:44:09 +0000 (12:44 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 23 Mar 2024 10:16:56 +0000 (10:16 +0000)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/files/toolchain-shar-relocate.sh

index e8ab357717f3235a02ac939567223c5c7253c54e..b017714df07743b5bc46c216be5dbefc0be381ee 100644 (file)
@@ -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 2>&1; 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