aboutsummaryrefslogtreecommitdiff
path: root/projects
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2017-06-22 11:44:19 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2017-06-23 09:25:42 -0400
commit46c6ca3b9ee3e545a41b3b0f488885b20a1c65b5 (patch)
treeaa647a35566e714faa801f66a711ebb6f0da34f3 /projects
parent7c8e518c62c6bbe6cd2b465099c561d8d53d38e9 (diff)
downloadlibrebootfr-46c6ca3b9ee3e545a41b3b0f488885b20a1c65b5.tar.gz
librebootfr-46c6ca3b9ee3e545a41b3b0f488885b20a1c65b5.zip
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.
Diffstat (limited to 'projects')
-rwxr-xr-xprojects/cros-scripts/install/cros-boot-keys54
-rwxr-xr-xprojects/cros-scripts/install/cros-firmware-prepare72
-rwxr-xr-xprojects/cros-scripts/install/cros-kernel-install50
-rwxr-xr-xprojects/cros-scripts/install/cros-kernel-prepare32
-rwxr-xr-xprojects/cros-scripts/install/cros-medium-setup46
-rwxr-xr-xprojects/crossgcc/crossgcc8
-rwxr-xr-xprojects/crossgcc/crossgcc-helper8
-rw-r--r--projects/libreboot-release/install/libreboot-release50
-rwxr-xr-xprojects/libreboot-sources/install/libreboot-sources22
-rwxr-xr-xprojects/libreboot-sources/libreboot-sources4
10 files changed, 173 insertions, 173 deletions
diff --git a/projects/cros-scripts/install/cros-boot-keys b/projects/cros-scripts/install/cros-boot-keys
index 416b7604..dffdc9b9 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 "$executable [action]\n" >&2
+ env printf '%s\n' "$executable [action]" >&2
- printf "\nActions:\n" >&2
- printf " generate - Generate a set of keys\n" >&2
- printf " verify - Verify keyblocks\n" >&2
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' generate - Generate a set of keys' >&2
+ env printf '%s\n' ' verify - Verify keyblocks' >&2
- printf "\nEnvironment variables:\n" >&2
- printf " KEYS_VERSION - Version to give the keys\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' ' KEYS_VERSION - Version to give the keys' >&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
}
keys_override_confirm() {
@@ -68,9 +68,9 @@ keys_override_confirm() {
return 0
fi
- printf "This is going to override keys stored in the following directory:\n"
- printf " $VBOOT_KEYS_PATH\n"
- printf "Press enter to confirm: "
+ env printf '%s\n' 'This is going to override keys stored in the following directory:'
+ env printf '%s\n' " $VBOOT_KEYS_PATH"
+ env printf '%s' 'Press enter to confirm: '
read confirm
}
@@ -89,8 +89,8 @@ generate() {
for key in $KEYS
do
- algorithm=$( echo "$algorithms" | sed "s/$REGEXP/\1/g" )
- algorithms=$( echo "$algorithms" | sed "s/$REGEXP/\2/g" )
+ algorithm=$( env printf '%s\n' "$algorithms" | sed "s/$REGEXP/\1/g" )
+ algorithms=$( env printf '%s\n' "$algorithms" | sed "s/$REGEXP/\2/g" )
key_length=$(( 1 << (10 + ($algorithm / 3)) ))
@@ -104,23 +104,23 @@ generate() {
rm -f "$VBOOT_KEYS_PATH/$key.$PEM" "$VBOOT_KEYS_PATH/$key.$CRT" "$VBOOT_KEYS_PATH/$key.$KEYB"
done
- printf "\nGenerated keys $KEYS\n"
+ env printf '\n%s\n' "Generated keys $KEYS"
for keyblock in $KEYBLOCKS
do
- pubkey=$( echo "$subkeys" | sed "s/$REGEXP/\1/g" )
- subkeys=$( echo "$subkeys" | sed "s/$REGEXP/\2/g" )
- privkey=$( echo "$subkeys" | sed "s/$REGEXP/\1/g" )
- subkeys=$( echo "$subkeys" | sed "s/$REGEXP/\2/g" )
+ pubkey=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+ privkey=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
- mode=$( echo "$modes" | sed "s/$REGEXP/\1/g" )
- modes=$( echo "$modes" | sed "s/$REGEXP/\2/g" )
+ mode=$( env printf '%s\n' "$modes" | sed "s/$REGEXP/\1/g" )
+ modes=$( env printf '%s\n' "$modes" | sed "s/$REGEXP/\2/g" )
futility vbutil_keyblock --pack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --flags "$mode" --datapubkey "$VBOOT_KEYS_PATH/$pubkey.$VBPUBK" --signprivate "$VBOOT_KEYS_PATH/$privkey.$VBPRIVK"
futility vbutil_keyblock --unpack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --signpubkey "$VBOOT_KEYS_PATH/$privkey.$VBPUBK"
done
- printf "\nGenerated keyblocks $KEYBLOCKS\n"
+ env printf '\n%s\n' "Generated keyblocks $KEYBLOCKS"
}
verify() {
@@ -130,15 +130,15 @@ verify() {
for keyblock in $KEYBLOCKS
do
- pubkey=$( echo "$subkeys" | sed "s/$REGEXP/\1/g" )
- subkeys=$( echo "$subkeys" | sed "s/$REGEXP/\2/g" )
- privkey=$( echo "$subkeys" | sed "s/$REGEXP/\1/g" )
- subkeys=$( echo "$subkeys" | sed "s/$REGEXP/\2/g" )
+ pubkey=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
+ privkey=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" )
+ subkeys=$( env printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" )
futility vbutil_keyblock --unpack "$VBOOT_KEYS_PATH/$keyblock.$KEYBLOCK" --signpubkey "$VBOOT_KEYS_PATH/$privkey.$VBPUBK"
done
- printf "\nVerified keyblocks $KEYBLOCKS\n"
+ env printf '\n%s\n' "Verified keyblocks $KEYBLOCKS"
}
requirements() {
@@ -151,7 +151,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
diff --git a/projects/cros-scripts/install/cros-firmware-prepare b/projects/cros-scripts/install/cros-firmware-prepare
index 73820f05..d2e15f29 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 "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]\n" >&2
+ env printf '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]" >&2
- printf "\nActions:\n" >&2
- printf " sign - Sign firmware image\n" >&2
- printf " verify - Verify firmware image\n" >&2
- printf " gbb - Google Binary Block\n" >&2
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' sign - Sign firmware image' >&2
+ env printf '%s\n' ' verify - Verify firmware image' >&2
+ env printf '%s\n' ' gbb - Google Binary Block' >&2
- printf "\nGBB actions:\n" >&2
- printf " extract - Extract GBB from firmware image to path \n" >&2
- printf " replace - Replace GBB from path to firmware image\n" >&2
- printf " list - List enabled GBB flags\n" >&2
- printf " enable - Enable GBB flag\n" >&2
- printf " disable - Disable GBB flag\n" >&2
+ env printf '\n%s\n' 'GBB actions:' >&2
+ env printf '%s\n' ' extract - Extract GBB from firmware image to path' >&2
+ env printf '%s\n' ' replace - Replace GBB from path to firmware image' >&2
+ env printf '%s\n' ' list - List enabled GBB flags' >&2
+ env printf '%s\n' ' enable - Enable GBB flag' >&2
+ env printf '%s\n' ' disable - Disable GBB flag' >&2
- printf "\nGBB flags:\n" >&2
+ env printf '\n%s\n' 'GBB flags:' >&2
for flag in $GBB_FLAGS
do
- printf " $flag\n" >&2
+ env printf '%s\n' " $flag" >&2
done
- printf "\nVPD actions:\n" >&2
- printf " extract - Extract VPD from firmware image to path \n" >&2
- printf " replace - Replace VPD from path to firmware image\n" >&2
+ env printf '\n%s\n' 'VPD actions:' >&2
+ env printf '%s\n' ' extract - Extract VPD from firmware image to path' >&2
+ env printf '%s\n' ' replace - Replace VPD from path to firmware image' >&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
}
sign() {
@@ -58,15 +58,15 @@ sign() {
futility sign --signprivate="$VBOOT_KEYS_PATH/firmware_data_key.$VBPRIVK" --keyblock "$VBOOT_KEYS_PATH/firmware.$KEYBLOCK" --kernelkey "$VBOOT_KEYS_PATH/kernel_subkey.$VBPUBK" --infile "$firmware_image_path"
futility gbb_utility -s --recoverykey="$VBOOT_KEYS_PATH/recovery_key.$VBPUBK" --rootkey="$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" "$firmware_image_path"
- printf "\nSigned firmwares image $firmware_image_path\n"
+ env printf '\n%s\n' "Signed firmwares image $firmware_image_path"
}
verify() {
local firmware_image_path=$1
- futility verify -k "$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" || ( printf "\nBad firmware image signature!\n" >&2 && return 1 )
+ futility verify -k "$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" || ( env printf '\n%s\n' "Bad firmware image signature!" >&2 && return 1 )
- printf "\nVerified firmware image $firmware_image_path\n"
+ env printf '\n%s\n' "Verified firmware image $firmware_image_path"
}
gbb() {
@@ -91,7 +91,7 @@ gbb() {
futility dump_fmap -x "$firmware_image_path" "GBB:$gbb_file_path"
- printf "\nExtracted GBB from $firmware_image_path to $gbb_file_path\n"
+ env printf '\n%s\n' "Extracted GBB from $firmware_image_path to $gbb_file_path"
;;
"replace")
if [ -z "$gbb_file_path" ]
@@ -102,10 +102,10 @@ gbb() {
futility load_fmap "$firmware_image_path" "GBB:$gbb_file_path"
- printf "\nReplaced GBB from $gbb_file_path to $firmware_image_path\n"
+ env printf '\n%s\n' "Replaced GBB from $gbb_file_path to $firmware_image_path"
;;
"list")
- printf "GBB flags in $firmware_image_path:\n"
+ env printf '%s\n' "GBB flags in $firmware_image_path:"
flags=$( gbb_flags_get "$firmware_image_path" )
@@ -115,7 +115,7 @@ gbb() {
if (( $flags & $flag_value ))
then
- printf " $flag\n"
+ env printf '%s\n' " $flag"
fi
i=$(( $i + 1 ))
@@ -134,15 +134,15 @@ gbb() {
if [ -z "$flag_value" ]
then
- printf "Invalid GBB flag: $gbb_flag\n" >&2
+ env printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2
exit 1
fi
- flags=$( printf "0x%x\n" $(( $flags | $flag_value )) )
+ flags=$( env printf "0x%x\n" $(( $flags | $flag_value )) )
gbb_flags_set "$firmware_image_path" "$flags"
- printf "\nEnabled GBB flag $gbb_flag in $firmware_image_path\n"
+ env printf '\n%s\n' "Enabled GBB flag $gbb_flag in $firmware_image_path"
;;
"disable")
if [ -z "$gbb_flag" ]
@@ -156,15 +156,15 @@ gbb() {
if [ -z "$flag_value" ]
then
- printf "Invalid GBB flag: $gbb_flag\n" >&2
+ env printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2
exit 1
fi
- flags=$( printf "0x%x\n" $(( $flags & ~$flag_value )) )
+ flags=$( env printf "0x%x\n" $(( $flags & ~$flag_value )) )
gbb_flags_set "$firmware_image_path" "$flags"
- printf "\nDisabled GBB flag $gbb_flag in $firmware_image_path\n"
+ env printf '\n%s\n' "Disabled GBB flag $gbb_flag in $firmware_image_path"
;;
*)
usage
@@ -196,7 +196,7 @@ gbb_flag_value() {
do
if [ "$gbb_flag" = "$flag" ]
then
- echo $(( 1 << $i ))
+ env printf '%d\n' $(( 1 << $i ))
return
fi
@@ -213,12 +213,12 @@ vpd() {
"extract")
futility dump_fmap -x "$firmware_image_path" "RO_VPD:$vpd_file_path"
- printf "\nExtracted VPD from $firmware_image_path to $vpd_file_path\n"
+ env printf '\n%s\n' "Extracted VPD from $firmware_image_path to $vpd_file_path"
;;
"replace")
futility load_fmap "$firmware_image_path" "RO_VPD:$vpd_file_path"
- printf "\nReplaced VPD from $vpd_file_path to $firmware_image_path\n"
+ env printf '\n%s\n' "Replaced VPD from $vpd_file_path to $firmware_image_path"
;;
*)
usage
@@ -237,7 +237,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
diff --git a/projects/cros-scripts/install/cros-kernel-install b/projects/cros-scripts/install/cros-kernel-install
index 589a36c0..e45915e9 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 "$executable [action] [storage] [kernel image|kernel modules]\n" >&2
+ env printf '%s\n' "$executable [action] [storage] [kernel image|kernel modules]" >&2
- printf "\nActions:\n" >&2
- printf " backup - Backup kernel image\n" >&2
- printf " image - Install kernel image\n" >&2
- printf " modules - Install kernel modules" >&2
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' backup - Backup kernel image' >&2
+ env printf '%s\n' ' image - Install kernel image' >&2
+ env printf '%s\n' ' modules - Install kernel modules' >&2
usage_storage
- 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
}
usage_storage() {
- printf "\nStorage:\n" >&2
+ env printf '\n%s\n' 'Storage:' >&2
local nodes=$( ls "$SYS_BLOCK_PATH" )
local node_path
@@ -58,7 +58,7 @@ usage_storage() {
continue
fi
- printf " $node_path - $name\n" >&2
+ env printf '%s\n' " $node_path - $name" >&2
done
}
@@ -68,9 +68,9 @@ storage_affect_confirm() {
local name=$( storage_name "$storage_path" )
local confirm
- printf "This is going to affect the following storage:\n"
- printf " $storage_path - $name\n"
- printf "Press enter to confirm: "
+ env printf '%s\n' 'This is going to affect the following storage:'
+ env printf '%s\n' " $storage_path - $name"
+ env printf '%s' 'Press enter to confirm: '
read confirm
}
@@ -95,17 +95,17 @@ storage_name() {
return 0
fi
- name=$( echo "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+ name=$( env printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
if [ -f "$vendor_path" ]
then
vendor=$( cat "$vendor_path" )
- vendor=$( echo "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+ vendor=$( env printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
name="$vendor $name"
fi
- echo "$name"
+ env printf '%s\n' "$name"
}
storage_partition_path() {
@@ -124,7 +124,7 @@ storage_partition_path() {
return 1
fi
- echo "$storage_partition_path"
+ env printf '%s\n' "$storage_partition_path"
}
storage_partition_mount_path() {
@@ -132,7 +132,7 @@ storage_partition_mount_path() {
local storage_partition_mount_path=$( udisksctl info -b "$storage_partition_path" | grep "MountPoints" | sed "s/.*MountPoints:[[:space:]]*\(.*\)/\1/g" )
- echo "$storage_partition_mount_path"
+ env printf '%s\n' "$storage_partition_mount_path"
}
storage_kernel_path() {
@@ -155,13 +155,13 @@ backup() {
if [ -z "$storage_kernel_path" ]
then
- printf "No kernel partition found on storage $storage_path\n" >&2
+ env printf '%s\n' "No kernel partition found on storage $storage_path" >&2
return 1
fi
cat "$storage_kernel_path" > "$kernel_image_path"
- printf "\nBacked up kernel image to $kernel_image_path\n"
+ env printf '\n%s\n' "Backed up kernel image to $kernel_image_path"
}
image() {
@@ -172,7 +172,7 @@ image() {
if [ -z "$storage_kernel_path" ]
then
- printf "No kernel partition found on storage $storage_path\n" >&2
+ env printf '%s\n' "No kernel partition found on storage $storage_path" >&2
return 1
fi
@@ -181,7 +181,7 @@ image() {
cat "$kernel_image_path" > "$storage_kernel_path"
sync
- printf "\nInstalled kernel image on storage $storage_path\n"
+ env printf '\n%s\n' "Installed kernel image on storage $storage_path"
}
modules() {
@@ -192,7 +192,7 @@ modules() {
if [ -z "$storage_rootfs_path" ]
then
- printf "No rootfs partition found on storage $storage_path\n" >&2
+ env printf '%s\n' "No rootfs partition found on storage $storage_path" >&2
return 1
fi
@@ -208,7 +208,7 @@ modules() {
udisksctl unmount -b "$storage_rootfs_path"
- printf "\nInstalled kernel modules on storage $storage_path\n"
+ env printf '\n%s\n' "Installed kernel modules on storage $storage_path"
}
requirements() {
@@ -221,7 +221,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
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
diff --git a/projects/cros-scripts/install/cros-medium-setup b/projects/cros-scripts/install/cros-medium-setup
index c3419868..b33c6744 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 "$executable [action] [storage] [rootfs tarball|kernel files] [medium]\n" >&2
+ env printf '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]" >&2
- printf "\nActions:\n" >&2
- printf " partitions - Setup partitions on storage\n" >&2
- printf " rootfs - Install rootfs tarball to storage\n" >&2
- printf " kernel - Install kernel files to storage\n" >&2
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' partitions - Setup partitions on storage' >&2
+ env printf '%s\n' ' rootfs - Install rootfs tarball to storage' >&2
+ env printf '%s\n' ' kernel - Install kernel files to storage' >&2
usage_storage
- printf "\nEnvironment variables:\n" >&2
- printf " KERNEL_PATH - Path to the kernel image\n" >&2
- printf " VBOOT_TOOLS_PATH - Path to vboot tools\n" >&2
+ env printf '\n%s\n' 'Environment variables:' >&2
+ env printf '%s\n' ' KERNEL_PATH - Path to the kernel image' >&2
+ env printf '%s\n' ' VBOOT_TOOLS_PATH - Path to vboot tools' >&2
}
usage_storage() {
- printf "\nStorage:\n" >&2
+ env printf '\n%s\n' 'Storage:' >&2
local nodes=$( ls "$SYS_BLOCK_PATH" )
local node_path
@@ -67,7 +67,7 @@ usage_storage() {
continue
fi
- printf " $node_path - $name\n" >&2
+ env printf '%s\n' " $node_path - $name" >&2
done
}
@@ -77,9 +77,9 @@ storage_affect_confirm() {
local name=$( storage_name "$storage_path" )
local confirm
- printf "This is going to affect the following storage:\n"
- printf " $storage_path - $name\n"
- printf "Press enter to confirm: "
+ env printf '%s\n' 'This is going to affect the following storage:'
+ env printf '%s\n' " $storage_path - $name"
+ env printf '%s' 'Press enter to confirm: '
read confirm
}
@@ -104,17 +104,17 @@ storage_name() {
return 0
fi
- name=$( echo "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+ name=$( env printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
if [ -f "$vendor_path" ]
then
vendor=$( cat "$vendor_path" )
- vendor=$( echo "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
+ vendor=$( env printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" )
name="$vendor $name"
fi
- echo "$name"
+ env printf '%s\n' "$name"
}
storage_partition_path() {
@@ -133,7 +133,7 @@ storage_partition_path() {
return 1
fi
- echo "$storage_partition_path"
+ env printf '%s\n' "$storage_partition_path"
}
storage_partition_mount_path() {
@@ -141,7 +141,7 @@ storage_partition_mount_path() {
local storage_partition_mount_path=$( udisksctl info -b "$storage_partition_path" | grep "MountPoints" | sed "s/.*MountPoints:[[:space:]]*\(.*\)/\1/g" )
- echo "$storage_partition_mount_path"
+ env printf '%s\n' "$storage_partition_mount_path"
}
partitions() {
@@ -161,7 +161,7 @@ partitions() {
udisksctl unmount -b "$partition" || true
done
- ( echo "g" ; echo "w" ) | fdisk "$storage_path"
+ ( env printf '%s\n' "g" ; env printf '%s\n' "w" ) | fdisk "$storage_path"
cgpt create "$storage_path"
@@ -180,7 +180,7 @@ partitions() {
mkfs.ext4 -F "$storage_rootfs_path"
- printf "\nSetup partitions on storage $storage_path\n"
+ env printf '\n%s\n' "Setup partitions on storage $storage_path"
}
rootfs() {
@@ -201,7 +201,7 @@ rootfs() {
udisksctl unmount -b "$storage_rootfs_path"
- printf "\nInstalled rootfs on storage $storage_path\n"
+ env printf '\n%s\n' "Installed rootfs on storage $storage_path"
}
kernel() {
@@ -230,7 +230,7 @@ kernel() {
udisksctl unmount -b "$storage_rootfs_path"
- printf "\nInstalled kernel on storage $storage_path\n"
+ env printf '\n%s\n' "Installed kernel on storage $storage_path"
}
requirements() {
@@ -243,7 +243,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
diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc
index aa930213..1fa3b041 100755
--- a/projects/crossgcc/crossgcc
+++ b/projects/crossgcc/crossgcc
@@ -52,7 +52,7 @@ extract() {
if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ]
then
- printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n"
+ env printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
mkdir -p "$tarball_install_directory_path"
@@ -92,7 +92,7 @@ update() {
if [ -f $tarball_sources_path ]
then
- printf "Copying source archive $tarball for $project (with ${arguments:-no argument})\n"
+ env printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})"
mkdir -p "$tarball_install_directory_path"
@@ -123,7 +123,7 @@ prefix() {
case $arch in
"arm")
- echo "$build_path/bin/arm-eabi-"
+ env printf '%s\n' "$build_path/bin/arm-eabi-"
;;
esac
}
@@ -180,7 +180,7 @@ release() {
if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ]
then
- printf "Releasing source archive $tarball for $project (with ${arguments:-no argument})\n"
+ env printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})"
cp "$tarball_install_path" "$tarball_release_path"
file_verification_create "$tarball_release_path"
diff --git a/projects/crossgcc/crossgcc-helper b/projects/crossgcc/crossgcc-helper
index b4979f89..a3d11ddf 100755
--- a/projects/crossgcc/crossgcc-helper
+++ b/projects/crossgcc/crossgcc-helper
@@ -20,7 +20,7 @@ crossgcc_tarballs() {
local install_path="$sources_path/util/crossgcc/tarballs/"
local tarballs=$( ls "$sources_path/util/crossgcc/sum" | sed "s/.cksum$//" )
- echo "$tarballs"
+ env printf '%s\n' "$tarballs"
}
crossgcc_tarball_sources_path() {
@@ -28,7 +28,7 @@ crossgcc_tarball_sources_path() {
local tarball_sources_path="$root/$SOURCES/$tarball"
- echo "$tarball_sources_path"
+ env printf '%s\n' "$tarball_sources_path"
}
crossgcc_tarball_install_path() {
@@ -39,7 +39,7 @@ crossgcc_tarball_install_path() {
local install_path="$sources_path/util/crossgcc/tarballs/"
local tarball_install_path="$install_path/$tarball"
- echo "$tarball_install_path"
+ env printf '%s\n' "$tarball_install_path"
}
crossgcc_tarball_release_path() {
@@ -49,5 +49,5 @@ crossgcc_tarball_release_path() {
local release_path=$( project_release_path "$project" "$SOURCES" "$@" )
local tarball_release_path="$release_path/$tarball"
- echo "$tarball_release_path"
+ env printf '%s\n' "$tarball_release_path"
}
diff --git a/projects/libreboot-release/install/libreboot-release b/projects/libreboot-release/install/libreboot-release
index b916adac..28674391 100644
--- a/projects/libreboot-release/install/libreboot-release
+++ b/projects/libreboot-release/install/libreboot-release
@@ -27,18 +27,18 @@ SHA256SUM="sha256sum"
ASC="asc"
usage() {
- printf "$executable [action] [projects...]\n" >&2
-
- printf "\nActions:\n" >&2
- printf " download - Download project files\n" >&2
- printf " sources - Download project sources\n" >&2
- printf " verify - Verify project files\n" >&2
- printf " extract - Extract project files\n" >&2
- printf " prepare - Download, verify and extract project files\n" >&2
-
- printf "\nEnvironment variables:\n" >&2
- printf " MACHINE - Machine architecture to use\n" >&2
- printf " DOWNLOAD_URL - Base URL to download files from\n" >&2
+ env printf '%s\n' "$executable [action] [projects...]" >&2
+
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' download - Download project files' >&2
+ env printf '%s\n' ' sources - Download project sources' >&2
+ env printf '%s\n' ' verify - Verify project files' >&2
+ env printf '%s\n' ' extract - Extract project files' >&2
+ env printf '%s\n' ' prepare - Download, verify and extract project files' >&2
+
+ env printf '\n%s\n' 'Environment variables:' >&2
+ env printf '%s\n' ' MACHINE - Machine architecture to use' >&2
+ env printf '%s\n' ' DOWNLOAD_URL - Base URL to download files from' >&2
}
download() {
@@ -76,7 +76,7 @@ download() {
wget -O "$path.$SHA256SUM" "$url.$SHA256SUM"
wget -O "$path.$ASC" "$url.$ASC"
- printf "\nDownloaded $project\n"
+ env printf '\n%s\n' "Downloaded $project"
return 0
fi
@@ -85,7 +85,7 @@ download() {
IFS=$ifs_save
done
- printf "Could not download $project from $DOWNLOAD_URL\n" >&2
+ env printf '%s\n' "Could not download $project from $DOWNLOAD_URL" >&2
return 1
}
@@ -102,9 +102,9 @@ sources() {
wget -O "$path.$SHA256SUM" "$url.$SHA256SUM"
wget -O "$path.$ASC" "$url.$ASC"
- printf "\nDownloaded $project sources\n"
+ env printf '\n%s\n' "Downloaded $project sources"
else
- printf "Could not download $project sources from $DOWNLOAD_URL\n" >&2
+ env printf '%s\n' "Could not download $project sources from $DOWNLOAD_URL" >&2
return 1
fi
@@ -153,17 +153,17 @@ verify() {
sha256sum -c "$project.$TAR_XZ.$SHA256SUM"
)
else
- printf "Could not verify $project checksum!\n" >&2
+ env printf '%s\n' "Could not verify $project checksum!" >&2
fi
if [ -f "$signature_path" ]
then
gpg --armor --verify "$signature_path" "$path"
else
- printf "Could not verify $project signature!\n" >&2
+ env printf '%s\n' "Could not verify $project signature!" >&2
fi
- printf "\nVerified $project\n"
+ env printf '\n%s\n' "Verified $project"
return 0
done
@@ -171,7 +171,7 @@ verify() {
IFS=$ifs_save
done
- printf "Could not verify $project\n" >&2
+ env printf '%s\n' "Could not verify $project" >&2
return 1
}
@@ -209,7 +209,7 @@ extract() {
if [ "$prefix" = "$SYSTEMS/$MACHINE" ]
then
- printf "Skiping $project extract\n"
+ env printf '%s\n' "Skiping $project extract"
return 0
fi
@@ -217,7 +217,7 @@ extract() {
tar -xf "$path" -ps -C "$extract_path"
- printf "Extracted $project\n"
+ env printf '%s\n' "Extracted $project"
return 0
done
@@ -225,7 +225,7 @@ extract() {
IFS=$ifs_save
done
- printf "Could not extract $project\n" >&2
+ env printf '%s\n' "Could not extract $project" >&2
return 1
}
@@ -239,7 +239,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
@@ -256,7 +256,7 @@ setup() {
if [ -z "$DOWNLOAD_URL" ]
then
- printf "Missing download URL\n" >&2
+ env printf '%s\n' 'Missing download URL' >&2
exit 1
fi
}
diff --git a/projects/libreboot-sources/install/libreboot-sources b/projects/libreboot-sources/install/libreboot-sources
index d2f19753..9d8536ef 100755
--- a/projects/libreboot-sources/install/libreboot-sources
+++ b/projects/libreboot-sources/install/libreboot-sources
@@ -21,15 +21,15 @@ SOURCES="sources"
TAR_XZ="tar.xz"
usage() {
- printf "$executable [action] [sources path] (extract path)\n" >&2
+ env printf '%s\n' "$executable [action] [sources path] (extract path)" >&2
- printf "\nActions:\n" >&2
- printf " extract - Extract build system sources\n" >&2
- printf " copy - Copy projects sources\n" >&2
- printf " prepare - Extract and copy sources\n" >&2
+ env printf '\n%s\n' 'Actions:' >&2
+ env printf '%s\n' ' extract - Extract build system sources' >&2
+ env printf '%s\n' ' copy - Copy projects sources' >&2
+ env printf '%s\n' ' prepare - Extract and copy sources' >&2
- printf "\n When no extract path is provided, sources are extracted in the current\n"
- printf " directory.\n"
+ env printf '\n%s\n' ' When no extract path is provided, sources are extracted in the current'
+ env printf '%s\n' ' directory.'
}
extract() {
@@ -49,14 +49,14 @@ extract() {
archive=$( find $sources_path -name "$BUILD_SYSTEM-sources.$TAR_XZ" || true )
if [ -z "$archive" ]
then
- printf "Finding $BUILD_SYSTEM sources archive failed!\n" >&2
+ env printf '%s\n' "Finding $BUILD_SYSTEM sources archive failed!" >&2
usage
exit 1
fi
tar -xf "$archive" -ps -C "$extract_path"
- printf "\nExtracted $BUILD_SYSTEM sources from $sources_path to $extract_path\n"
+ env printf '\n%s\n' "Extracted $BUILD_SYSTEM sources from $sources_path to $extract_path"
}
copy() {
@@ -83,7 +83,7 @@ copy() {
cp "$file" "$build_system_sources_path"
done
- printf "\nCopied $BUILD_SYSTEM sources from $sources_path to $extract_path\n"
+ env printf '\n%s\n' "Copied $BUILD_SYSTEM sources from $sources_path to $extract_path"
}
requirements() {
@@ -96,7 +96,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
diff --git a/projects/libreboot-sources/libreboot-sources b/projects/libreboot-sources/libreboot-sources
index a7fa5435..259cb10a 100755
--- a/projects/libreboot-sources/libreboot-sources
+++ b/projects/libreboot-sources/libreboot-sources
@@ -38,8 +38,8 @@ release() {
project_release_install "$project" "$TOOLS" "$@"
- echo "$VERSION" > "$sources_path/$DOTVERSION"
- echo "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH"
+ env printf '%s\n' "$VERSION" > "$sources_path/$DOTVERSION"
+ env printf '%s\n' "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH"
if git_check "$sources_path"
then