From 4e3505463eadffd9f1994f8ecaba9b1d693ec7bf Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Wed, 25 Oct 2017 23:11:15 -0400 Subject: Modify fd copying in printf calls for readability --- projects/cros-scripts/install/cros-boot-keys | 18 ++++----- .../cros-scripts/install/cros-firmware-prepare | 44 +++++++++++----------- projects/cros-scripts/install/cros-kernel-install | 28 +++++++------- projects/cros-scripts/install/cros-kernel-prepare | 26 ++++++------- projects/cros-scripts/install/cros-medium-setup | 22 +++++------ .../libreboot-release/install/libreboot-release | 40 ++++++++++---------- .../libreboot-sources/install/libreboot-sources | 14 +++---- 7 files changed, 96 insertions(+), 96 deletions(-) (limited to 'projects') diff --git a/projects/cros-scripts/install/cros-boot-keys b/projects/cros-scripts/install/cros-boot-keys index 28b25175..53db579f 100755 --- a/projects/cros-scripts/install/cros-boot-keys +++ b/projects/cros-scripts/install/cros-boot-keys @@ -31,16 +31,16 @@ ALGORITHMS="7 7 11 7 7 4 11 11 11" MODES="7 7 11 7 10" usage() { - printf '%s\n' "$executable [action]" >&2 + printf 1>&2 '%s\n' "$executable [action]" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' generate - Generate a set of keys' >&2 - printf '%s\n' ' verify - Verify keyblocks' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' generate - Generate a set of keys' + printf 1>&2 '%s\n' ' verify - Verify keyblocks' - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' KEYS_VERSION - Version to give the keys' >&2 - printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 - printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' KEYS_VERSION - Version to give the keys' + printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' + printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' } keys_override_confirm() { @@ -151,7 +151,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done diff --git a/projects/cros-scripts/install/cros-firmware-prepare b/projects/cros-scripts/install/cros-firmware-prepare index 52deadf5..8fceffb4 100755 --- a/projects/cros-scripts/install/cros-firmware-prepare +++ b/projects/cros-scripts/install/cros-firmware-prepare @@ -22,34 +22,34 @@ VBPUBK="vbpubk" GBB_FLAGS="dev_screen_short_delay load_option_roms enable_alternate_os force_dev_switch_on force_dev_boot_usb disable_fw_rollback_check enter_triggers_tonorm force_dev_boot_legacy faft_key_overide disable_ec_software_sync default_dev_boot_lefacy disable_pd_software_sync disable_lid_shutdown dev_boot_fastboot_full_cap enable_serial" usage() { - printf '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]" >&2 + printf 1>&2 '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' sign - Sign firmware image' >&2 - printf '%s\n' ' verify - Verify firmware image' >&2 - printf '%s\n' ' gbb - Google Binary Block' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' sign - Sign firmware image' + printf 1>&2 '%s\n' ' verify - Verify firmware image' + printf 1>&2 '%s\n' ' gbb - Google Binary Block' - printf '\n%s\n' 'GBB actions:' >&2 - printf '%s\n' ' extract - Extract GBB from firmware image to path' >&2 - printf '%s\n' ' replace - Replace GBB from path to firmware image' >&2 - printf '%s\n' ' list - List enabled GBB flags' >&2 - printf '%s\n' ' enable - Enable GBB flag' >&2 - printf '%s\n' ' disable - Disable GBB flag' >&2 + printf 1>&2 '\n%s\n' 'GBB actions:' + printf 1>&2 '%s\n' ' extract - Extract GBB from firmware image to path' + printf 1>&2 '%s\n' ' replace - Replace GBB from path to firmware image' + printf 1>&2 '%s\n' ' list - List enabled GBB flags' + printf 1>&2 '%s\n' ' enable - Enable GBB flag' + printf 1>&2 '%s\n' ' disable - Disable GBB flag' - printf '\n%s\n' 'GBB flags:' >&2 + printf 1>&2 '\n%s\n' 'GBB flags:' for flag in $GBB_FLAGS do - printf '%s\n' " $flag" >&2 + printf 1>&2 '%s\n' " $flag" done - printf '\n%s\n' 'VPD actions:' >&2 - printf '%s\n' ' extract - Extract VPD from firmware image to path' >&2 - printf '%s\n' ' replace - Replace VPD from path to firmware image' >&2 + printf 1>&2 '\n%s\n' 'VPD actions:' + printf 1>&2 '%s\n' ' extract - Extract VPD from firmware image to path' + printf 1>&2 '%s\n' ' replace - Replace VPD from path to firmware image' - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 - printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' + printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' } sign() { @@ -134,7 +134,7 @@ gbb() { if [ -z "$flag_value" ] then - printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 + printf 1>&2 '%s\n' "Invalid GBB flag: $gbb_flag" exit 1 fi @@ -156,7 +156,7 @@ gbb() { if [ -z "$flag_value" ] then - printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 + printf 1>&2 '%s\n' "Invalid GBB flag: $gbb_flag" exit 1 fi @@ -237,7 +237,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done diff --git a/projects/cros-scripts/install/cros-kernel-install b/projects/cros-scripts/install/cros-kernel-install index 7333b3fa..8f6c69e9 100755 --- a/projects/cros-scripts/install/cros-kernel-install +++ b/projects/cros-scripts/install/cros-kernel-install @@ -23,22 +23,22 @@ MODEL="model" NAME="name" usage() { - printf '%s\n' "$executable [action] [storage] [kernel image|kernel modules]" >&2 + printf 1>&2 '%s\n' "$executable [action] [storage] [kernel image|kernel modules]" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' backup - Backup kernel image' >&2 - printf '%s\n' ' image - Install kernel image' >&2 - printf '%s\n' ' modules - Install kernel modules' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' backup - Backup kernel image' + printf 1>&2 '%s\n' ' image - Install kernel image' + printf 1>&2 '%s\n' ' modules - Install kernel modules' usage_storage - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 - printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' + printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' } usage_storage() { - printf '\n%s\n' 'Storage:' >&2 + printf 1>&2 '\n%s\n' 'Storage:' local nodes=$( ls "$SYS_BLOCK_PATH" ) local node_path @@ -58,7 +58,7 @@ usage_storage() { continue fi - printf '%s\n' " $node_path - $name" >&2 + printf 1>&2 '%s\n' " $node_path - $name" done } @@ -155,7 +155,7 @@ backup() { if [ -z "$storage_kernel_path" ] then - printf '%s\n' "No kernel partition found on storage $storage_path" >&2 + printf 1>&2 '%s\n' "No kernel partition found on storage $storage_path" return 1 fi @@ -172,7 +172,7 @@ image() { if [ -z "$storage_kernel_path" ] then - printf '%s\n' "No kernel partition found on storage $storage_path" >&2 + printf 1>&2 '%s\n' "No kernel partition found on storage $storage_path" return 1 fi @@ -192,7 +192,7 @@ modules() { if [ -z "$storage_rootfs_path" ] then - printf '%s\n' "No rootfs partition found on storage $storage_path" >&2 + printf 1>&2 '%s\n' "No rootfs partition found on storage $storage_path" return 1 fi @@ -221,7 +221,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done diff --git a/projects/cros-scripts/install/cros-kernel-prepare b/projects/cros-scripts/install/cros-kernel-prepare index 047bb5c1..8dd5c797 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 '%s\n' "$executable [action] [kernel files|kernel image] [medium]" >&2 + printf 1>&2 '%s\n' "$executable [action] [kernel files|kernel image] [medium]" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' pack - Pack kernel files to a medium-specific image' >&2 - printf '%s\n' ' sign - Sign kernel image' >&2 - printf '%s\n' ' verify - Very kernel image signatures' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' pack - Pack kernel files to a medium-specific image' + printf 1>&2 '%s\n' ' sign - Sign kernel image' + printf 1>&2 '%s\n' ' verify - Very kernel image signatures' - printf '\n%s\n' 'Medium:' >&2 - printf '%s\n' ' usb - External USB storage' >&2 - printf '%s\n' ' mmc - External SD card storage' >&2 - printf '%s\n' ' emmc - Internal storage' >&2 + printf 1>&2 '\n%s\n' 'Medium:' + printf 1>&2 '%s\n' ' usb - External USB storage' + printf 1>&2 '%s\n' ' mmc - External SD card storage' + printf 1>&2 '%s\n' ' emmc - Internal storage' - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 - printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' + printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' } pack() { @@ -88,7 +88,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done diff --git a/projects/cros-scripts/install/cros-medium-setup b/projects/cros-scripts/install/cros-medium-setup index 2b278a9d..6295e0ec 100755 --- a/projects/cros-scripts/install/cros-medium-setup +++ b/projects/cros-scripts/install/cros-medium-setup @@ -32,22 +32,22 @@ GPT_SIZE=34 KERNEL_SIZE=16384 usage() { - printf '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]" >&2 + printf 1>&2 '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' partitions - Setup partitions on storage' >&2 - printf '%s\n' ' rootfs - Install rootfs tarball to storage' >&2 - printf '%s\n' ' kernel - Install kernel files to storage' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' partitions - Setup partitions on storage' + printf 1>&2 '%s\n' ' rootfs - Install rootfs tarball to storage' + printf 1>&2 '%s\n' ' kernel - Install kernel files to storage' usage_storage - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' KERNEL_PATH - Path to the kernel image' >&2 - printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2 + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' KERNEL_PATH - Path to the kernel image' + printf 1>&2 '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' } usage_storage() { - printf '\n%s\n' 'Storage:' >&2 + printf 1>&2 '\n%s\n' 'Storage:' local nodes=$( ls "$SYS_BLOCK_PATH" ) local node_path @@ -67,7 +67,7 @@ usage_storage() { continue fi - printf '%s\n' " $node_path - $name" >&2 + printf 1>&2 '%s\n' " $node_path - $name" done } @@ -243,7 +243,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done diff --git a/projects/libreboot-release/install/libreboot-release b/projects/libreboot-release/install/libreboot-release index 08c4d64b..469d4db4 100644 --- a/projects/libreboot-release/install/libreboot-release +++ b/projects/libreboot-release/install/libreboot-release @@ -27,18 +27,18 @@ CHECKSUM="sha256sum" ASC="asc" usage() { - printf '%s\n' "$executable [action] [projects...]" >&2 - - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' download - Download project files' >&2 - printf '%s\n' ' sources - Download project sources' >&2 - printf '%s\n' ' verify - Verify project files' >&2 - printf '%s\n' ' extract - Extract project files' >&2 - printf '%s\n' ' prepare - Download, verify and extract project files' >&2 - - printf '\n%s\n' 'Environment variables:' >&2 - printf '%s\n' ' MACHINE - Machine architecture to use' >&2 - printf '%s\n' ' DOWNLOAD_URL - Base URL to download files from' >&2 + printf 1>&2 '%s\n' "$executable [action] [projects...]" + + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' download - Download project files' + printf 1>&2 '%s\n' ' sources - Download project sources' + printf 1>&2 '%s\n' ' verify - Verify project files' + printf 1>&2 '%s\n' ' extract - Extract project files' + printf 1>&2 '%s\n' ' prepare - Download, verify and extract project files' + + printf 1>&2 '\n%s\n' 'Environment variables:' + printf 1>&2 '%s\n' ' MACHINE - Machine architecture to use' + printf 1>&2 '%s\n' ' DOWNLOAD_URL - Base URL to download files from' } download() { @@ -85,7 +85,7 @@ download() { IFS=$ifs_save done - printf '%s\n' "Could not download $project from $DOWNLOAD_URL" >&2 + printf 1>&2 '%s\n' "Could not download $project from $DOWNLOAD_URL" return 1 } @@ -104,7 +104,7 @@ sources() { printf '\n%s\n' "Downloaded $project sources" else - printf '%s\n' "Could not download $project sources from $DOWNLOAD_URL" >&2 + printf 1>&2 '%s\n' "Could not download $project sources from $DOWNLOAD_URL" return 1 fi @@ -153,14 +153,14 @@ verify() { sha256sum -c "$project.$ARCHIVE.$CHECKSUM" ) else - printf '%s\n' "Could not verify $project checksum!" >&2 + printf 1>&2 '%s\n' "Could not verify $project checksum!" fi if [ -f "$signature_path" ] then gpg --armor --verify "$signature_path" "$path" else - printf '%s\n' "Could not verify $project signature!" >&2 + printf 1>&2 '%s\n' "Could not verify $project signature!" fi printf '\n%s\n' "Verified $project" @@ -171,7 +171,7 @@ verify() { IFS=$ifs_save done - printf '%s\n' "Could not verify $project" >&2 + printf 1>&2 '%s\n' "Could not verify $project" return 1 } @@ -225,7 +225,7 @@ extract() { IFS=$ifs_save done - printf '%s\n' "Could not extract $project" >&2 + printf 1>&2 '%s\n' "Could not extract $project" return 1 } @@ -239,7 +239,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done @@ -256,7 +256,7 @@ setup() { if [ -z "$DOWNLOAD_URL" ] then - printf '%s\n' 'Missing download URL' >&2 + printf 1>&2 '%s\n' 'Missing download URL' exit 1 fi } diff --git a/projects/libreboot-sources/install/libreboot-sources b/projects/libreboot-sources/install/libreboot-sources index d836054d..162aef32 100755 --- a/projects/libreboot-sources/install/libreboot-sources +++ b/projects/libreboot-sources/install/libreboot-sources @@ -21,12 +21,12 @@ SOURCES="sources" ARCHIVE="tar.xz" usage() { - printf '%s\n' "$executable [action] [sources path] (extract path)" >&2 + printf 1>&2 '%s\n' "$executable [action] [sources path] (extract path)" - printf '\n%s\n' 'Actions:' >&2 - printf '%s\n' ' extract - Extract build system sources' >&2 - printf '%s\n' ' copy - Copy projects sources' >&2 - printf '%s\n' ' prepare - Extract and copy sources' >&2 + printf 1>&2 '\n%s\n' 'Actions:' + printf 1>&2 '%s\n' ' extract - Extract build system sources' + printf 1>&2 '%s\n' ' copy - Copy projects sources' + printf 1>&2 '%s\n' ' prepare - Extract and copy sources' printf '\n%s\n' ' When no extract path is provided, sources are extracted in the current' printf '%s\n' ' directory.' @@ -49,7 +49,7 @@ extract() { archive=$( find $sources_path -name "$BUILD_SYSTEM-sources.$ARCHIVE" || true ) if [ -z "$archive" ] then - printf '%s\n' "Finding $BUILD_SYSTEM sources archive failed!" >&2 + printf 1>&2 '%s\n' "Finding $BUILD_SYSTEM sources archive failed!" usage exit 1 fi @@ -96,7 +96,7 @@ requirements() { if [ -z "$requirement_path" ] then - printf '%s\n' "Missing requirement: $requirement" >&2 + printf 1>&2 '%s\n' "Missing requirement: $requirement" exit 1 fi done -- cgit v1.2.3-70-g09d2