From 46c6ca3b9ee3e545a41b3b0f488885b20a1c65b5 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 22 Jun 2017 11:44:19 -0400 Subject: Fixed printf calls & replaced 'echo' w/ printf. All printf calls should now be properly formatted; prior, the format specifier string was erroneously used for both the format specifiers and the string to be printed. 'env' is now used to locate the printf binary so as to avoid potentially using a shell builtin. Lastly, all calls to 'echo' within the new build system have been replaced with printf for consistency/portability purposes. --- projects/cros-scripts/install/cros-kernel-prepare | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'projects/cros-scripts/install/cros-kernel-prepare') diff --git a/projects/cros-scripts/install/cros-kernel-prepare b/projects/cros-scripts/install/cros-kernel-prepare index 4f374db4..e1c7cacb 100755 --- a/projects/cros-scripts/install/cros-kernel-prepare +++ b/projects/cros-scripts/install/cros-kernel-prepare @@ -27,21 +27,21 @@ FIT="fit" IMG="img" usage() { - printf "$executable [action] [kernel files|kernel image] [medium]\n" >&2 + env printf '%s\n' "$executable [action] [kernel files|kernel image] [medium]" >&2 - printf "\nActions:\n" >&2 - printf " pack - Pack kernel files to a medium-specific image\n" >&2 - printf " sign - Sign kernel image\n" >&2 - printf " verify - Very kernel image signatures\n" >&2 + env printf '\n%s\n' 'Actions:' >&2 + env printf '%s\n' ' pack - Pack kernel files to a medium-specific image' >&2 + env printf '%s\n' ' sign - Sign kernel image' >&2 + env printf '%s\n' ' verify - Very kernel image signatures' >&2 - printf "\nMedium:\n" >&2 - printf " usb - External USB storage\n" >&2 - printf " mmc - External SD card storage\n" >&2 - printf " emmc - Internal storage\n" >&2 + env printf '\n%s\n' 'Medium:' >&2 + env printf '%s\n' ' usb - External USB storage' >&2 + env printf '%s\n' ' mmc - External SD card storage' >&2 + env printf '%s\n' ' emmc - Internal storage' >&2 - printf "\nEnvironment variables:\n" >&2 - printf " VBOOT_KEYS_PATH - Path to the vboot keys\n" >&2 - printf " VBOOT_TOOLS_PATH - Path to vboot tools\n" >&2 + env printf '\n%s\n' 'Environment variables:' >&2 + env printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 + env printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 } pack() { @@ -59,7 +59,7 @@ pack() { mkimage -f "$kernel_its_path" "$kernel_fit_path" futility vbutil_kernel --pack "$kernel_image_path" --version 1 --arch "$arch" --keyblock "$VBOOT_KEYS_PATH/kernel.$KEYBLOCK" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.$VBPRIVK" --config "$cmdline_path" --vmlinuz "$kernel_fit_path" --bootloader "$bootloader_path" - printf "\nPacked kernel image $kernel_image_path\n" + env printf '\n%s\n' "Packed kernel image $kernel_image_path" } sign() { @@ -67,7 +67,7 @@ sign() { futility vbutil_kernel --repack "$kernel_image_path" --version 1 --keyblock "$VBOOT_KEYS_PATH/kernel.$KEYBLOCK" --signprivate "$VBOOT_KEYS_PATH/kernel_data_key.$VBPRIVK" --oldblob "$kernel_image_path" - printf "\nSigned kernel image $kernel_image_path\n" + env printf '\n%s\n' "Signed kernel image $kernel_image_path" } verify() { @@ -75,7 +75,7 @@ verify() { futility vbutil_kernel --verify "$kernel_image_path" --signpubkey "$VBOOT_KEYS_PATH/kernel_subkey.$VBPUBK" - printf "\nVerified kernel image $kernel_image_path\n" + env printf '\n%s\n' "Verified kernel image $kernel_image_path" } requirements() { @@ -88,7 +88,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf "Missing requirement: $requirement\n" >&2 + env printf '%s\n' "Missing requirement: $requirement" >&2 exit 1 fi done -- cgit v1.2.3-70-g09d2