fwupd/plugins/uefi/efi/generate_binary.sh
Jan Tojnar 34743c5fab uefi: Make generate_binary.sh more robust
command is a shell builtin unlike which, which might not be available.

While at it, let us also make the variables space-safe.
2019-11-18 18:43:40 +00:00

23 lines
502 B
Bash
Executable File

#!/bin/sh
output=$2
objcopy_cmd=$(command -v objcopy)
genpeimg_cmd=$(command -v genpeimg)
"$objcopy_cmd" -j .text \
-j .sdata \
-j .data \
-j .dynamic \
-j .dynsym \
-j '.rel*' \
"$@"
if [ -n "${genpeimg_cmd}" ]; then
$genpeimg_cmd -d \
+d \
-d \
+n \
-d \
+s \
"$output"
fi