[elbe-devel] [PATCH v2] build_sdk toolchain-shar-extract.sk.mako: only try to reloc ELF executables
Manuel Traut
manut at linutronix.de
Wed Apr 24 15:18:29 CEST 2019
On 15:14 Wed 24 Apr , Torben Hohn wrote:
> scripts are marked executable, but are not suposed to be relocated using
> patchelf. Trying to get patchelf to relocate a script yields an error,
> and stops the rlocation process.
>
> Use file to check whether the executables are actually elf files.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
What if 'file' is not installed? IMHO it's e.g. not there on a minimal Debian
installation.
Shouldn't we add something like we have for patchelf?
--8<--
PATCHELF=\`which patchelf 2>/dev/null\`
if [ x\$PATCHELF = "x" ]; then
echo "SDK could not be relocated. No patchelf found."
echo "use 'sudo apt install patchelf' on Debian"
exit 1
fi
--8<--
> ---
> elbepack/makofiles/toolchain-shar-extract.sh.mako | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> index 96810aad..40e2dc86 100644
> --- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
> +++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> @@ -280,7 +280,10 @@ if [ "$dl_path" = "" ] ; then
> exit 1
> fi
> executable_files=$($SUDO_EXEC find $native_sysroot -type f \
> - \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
> + \( -perm -0100 -o -perm -0010 -o -perm -0001 \) \
> + -exec sh -c "file {} | grep -Pi ': elf (32|64)-bit' > /dev/null" \; \
> + -printf "'%h/%f' ")
> +
> if [ "x$executable_files" = "x" ]; then
> echo "SDK relocate failed, could not get executalbe files"
> exit 1
> --
> 2.11.0
>
More information about the elbe-devel
mailing list