diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-06-23 13:55:22 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-06-23 13:55:22 -0400 |
commit | 4e50a92041c9f30deef1a32c995b9d5634cbed22 (patch) | |
tree | 889014b8974bb439a7a665ce991036ea5d41fd01 | |
parent | bdb6c0e643f9d4b4ce3e0ceba113c04bd45d5116 (diff) | |
download | librebootfr-4e50a92041c9f30deef1a32c995b9d5634cbed22.tar.gz librebootfr-4e50a92041c9f30deef1a32c995b9d5634cbed22.zip |
Remove unnecessary 'env' invocation from printf.
This reverts part of pull request #217 which called the 'env'
binary for each printf invocation.
-rwxr-xr-x | libreboot | 50 | ||||
-rwxr-xr-x | libs/common | 20 | ||||
-rwxr-xr-x | libs/git | 4 | ||||
-rwxr-xr-x | libs/project | 102 | ||||
-rwxr-xr-x | libs/tool | 36 | ||||
-rwxr-xr-x | projects/cros-scripts/install/cros-boot-keys | 54 | ||||
-rwxr-xr-x | projects/cros-scripts/install/cros-firmware-prepare | 72 | ||||
-rwxr-xr-x | projects/cros-scripts/install/cros-kernel-install | 50 | ||||
-rwxr-xr-x | projects/cros-scripts/install/cros-kernel-prepare | 32 | ||||
-rwxr-xr-x | projects/cros-scripts/install/cros-medium-setup | 46 | ||||
-rwxr-xr-x | projects/crossgcc/crossgcc | 8 | ||||
-rwxr-xr-x | projects/crossgcc/crossgcc-helper | 8 | ||||
-rw-r--r-- | projects/libreboot-release/install/libreboot-release | 50 | ||||
-rwxr-xr-x | projects/libreboot-sources/install/libreboot-sources | 22 | ||||
-rwxr-xr-x | projects/libreboot-sources/libreboot-sources | 4 | ||||
-rwxr-xr-x | tools/blobs-discover/blobs-discover | 18 | ||||
-rwxr-xr-x | tools/boot-keys/boot-keys | 10 | ||||
-rwxr-xr-x | tools/boot-keys/boot-keys-helper | 4 |
18 files changed, 295 insertions, 295 deletions
@@ -22,53 +22,53 @@ libreboot_usage() { local action local target - env printf '%s\n' "${executable} [action] [target] [arguments]" >&2 + printf '%s\n' "${executable} [action] [target] [arguments]" >&2 - env printf '\n%s\n' 'Generic project actions:' >&2 + printf '\n%s\n' 'Generic project actions:' >&2 for action in ${PROJECT_ACTIONS_GENERIC}; do - env printf '%s\n' " ${action}" >&2 + printf '%s\n' " ${action}" >&2 done - env printf '\n%s\n' 'Virtual project actions:' >&2 + printf '\n%s\n' 'Virtual project actions:' >&2 - env printf '%s\n' ' sources' - env printf '%s\n' ' produce' - env printf '%s\n' ' test' + printf '%s\n' ' sources' + printf '%s\n' ' produce' + printf '%s\n' ' test' - env printf '\n%s\n' 'Project targets:' >&2 + printf '\n%s\n' 'Project targets:' >&2 for target in "${root}/${PROJECTS}"/*; do if project_check "${target}"; then - env printf '%s\n' " ${target}" >&2 + printf '%s\n' " ${target}" >&2 fi done - env printf '\n%s\n' 'Generic tool actions:' >&2 + printf '\n%s\n' 'Generic tool actions:' >&2 for action in ${TOOL_ACTIONS_GENERIC}; do - env printf '%s\n' " ${action}" >&2 + printf '%s\n' " ${action}" >&2 done - env printf '\n%s\n' 'Tool targets:' >&2 + printf '\n%s\n' 'Tool targets:' >&2 for target in "${root}/${TOOLS}"/*; do if tool_check "${target}"; then - env printf '%s\n' " ${target}" >&2 + printf '%s\n' " ${target}" >&2 fi done - env printf '\n%s\n' 'Environment variables:' >&2 - env printf '%s\n' ' PROJECTS_FORCE - Projects to always perform actions for' >&2 - env printf '%s\n' ' TOOLS_FORCE - Tools to always perform actions for' >&2 - env printf '%s\n' ' RELEASE_KEY - GPG key to use for release' >&2 - env printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 - env printf '%s\n' ' LIBFAKETIME_PATH - Path to the libfaketime shared library' >&2 - env printf '%s\n' ' TASKS - Number of simultaneous tasks to run' >&2 - env printf '%s\n' ' VERSION - Version string to use' >&2 - - env printf '\n%s\n' 'Configuration files:' >&2 - env printf '%s\n' " ${BUILD_SYSTEM}.conf - Environment variables configuration" >&2 + printf '\n%s\n' 'Environment variables:' >&2 + printf '%s\n' ' PROJECTS_FORCE - Projects to always perform actions for' >&2 + printf '%s\n' ' TOOLS_FORCE - Tools to always perform actions for' >&2 + printf '%s\n' ' RELEASE_KEY - GPG key to use for release' >&2 + printf '%s\n' ' VBOOT_KEYS_PATH - Path to the vboot keys' >&2 + printf '%s\n' ' LIBFAKETIME_PATH - Path to the libfaketime shared library' >&2 + printf '%s\n' ' TASKS - Number of simultaneous tasks to run' >&2 + printf '%s\n' ' VERSION - Version string to use' >&2 + + printf '\n%s\n' 'Configuration files:' >&2 + printf '%s\n' " ${BUILD_SYSTEM}.conf - Environment variables configuration" >&2 } libreboot_project() { @@ -147,7 +147,7 @@ libreboot_setup() { requirement_path="$(which "${requirement}" || true)" if [[ -z "${requirement_path}" ]]; then - env printf '%s\n' "Missing requirement: ${requirement}" >&2 + printf '%s\n' "Missing requirement: ${requirement}" >&2 exit 1 fi done diff --git a/libs/common b/libs/common index bcae2a9d..ce0df299 100755 --- a/libs/common +++ b/libs/common @@ -60,7 +60,7 @@ arguments_list() { for argument in "$@" do - env printf '%s\n' "$argument" + printf '%s\n' "$argument" done } @@ -85,7 +85,7 @@ path_wildcard_expand() { local path=$@ # Evaluation fails with unescaped whitespaces. - path=$( env printf '%s\n' "$path" | sed "s/ /\\\ /g" ) + path=$( printf '%s\n' "$path" | sed "s/ /\\\ /g" ) eval "arguments_list "$path"" } @@ -112,7 +112,7 @@ file_checksum_check() { if ! [ -f "$checksum_path" ] then - env printf '%s\n' 'Could not verify file checksum!' >&2 + printf '%s\n' 'Could not verify file checksum!' >&2 return 1 fi @@ -142,7 +142,7 @@ file_signature_check() { if ! [ -f "$signature_path" ] then - env printf '%s\n' 'Could not verify file signature!' >&2 + printf '%s\n' 'Could not verify file signature!' >&2 return 1 fi @@ -336,7 +336,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + printf '%s\n' "Missing requirement: $requirement" >&2 exit 1 fi done @@ -353,7 +353,7 @@ requirements_root() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + printf '%s\n' "Missing requirement: $requirement" >&2 exit 1 fi done @@ -375,22 +375,22 @@ arguments_concat() { fi done - env printf '%s\n' "$concat" + printf '%s\n' "$concat" } execute_root() { local sudo=$( which sudo 2> /dev/null || true ) local arguments - env printf '%s' 'Running command as root: ' >&2 - env printf '%b\n' "$*" >&2 + printf '%s' 'Running command as root: ' >&2 + printf '%b\n' "$*" >&2 if ! [ -z "$sudo" ] then sudo "$@" else # Quote arguments for eval through su. - arguments=$( env printf '%q ' "$@" ) + arguments=$( printf '%q ' "$@" ) su -c "$arguments" fi } @@ -214,7 +214,7 @@ git_files() { git_project_repository_path() { local repository=$1 - env printf '%s\n' "$root/$SOURCES/$repository" + printf '%s\n' "$root/$SOURCES/$repository" } git_project_check() { @@ -582,7 +582,7 @@ git_project_release() { local archive_path="$root/$RELEASE/$SOURCES/$project/$release_branch.$TAR_XZ" local sources_path="$root/$SOURCES/$repository" - env printf '%s\n' "Releasing sources archive for $project (with ${arguments:-no argument}) from "$repository" git" + printf '%s\n' "Releasing sources archive for $project (with ${arguments:-no argument}) from "$repository" git" git_branch_checkout "$repository_path" "$release_branch" git_submodule_update "$repository_path" diff --git a/libs/project b/libs/project index b8d7862b..dc2e056f 100755 --- a/libs/project +++ b/libs/project @@ -17,7 +17,7 @@ PROJECT_ACTIONS_GENERIC="usage download extract update build install release clean" PROJECT_ACTIONS_HELPERS="arguments" -PROJECT_FUNCTIONS=$( for action in $PROJECT_ACTIONS_GENERIC ; do env printf '%s\n' "$action" "$action""_check" ; done ; env printf '%s\n' "$PROJECT_ACTIONS_HELPERS" ) +PROJECT_FUNCTIONS=$( for action in $PROJECT_ACTIONS_GENERIC ; do printf '%s\n' "$action" "$action""_check" ; done ; printf '%s\n' "$PROJECT_ACTIONS_HELPERS" ) INSTALL_REGEX="\([^:]*\):\(.*\)" @@ -81,7 +81,7 @@ project_action() { if ! project_check "$project" then - env printf '%s\n' "Project $project check failed" >&2 + printf '%s\n' "Project $project check failed" >&2 return 1 fi @@ -100,7 +100,7 @@ project_action() { return 0 fi - env printf '%s\n' "Project $project $action (with ${arguments:-no argument})" >&2 + printf '%s\n' "Project $project $action (with ${arguments:-no argument})" >&2 ( set -e @@ -109,10 +109,10 @@ project_action() { if [ $? -ne 0 ] then - env printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) failed" >&2 + printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) failed" >&2 return 1 else - env printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) completed" >&2 + printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) completed" >&2 fi ) } @@ -128,7 +128,7 @@ project_action_check() { if ! project_check "$project" then - env printf '%s\n' "Project $project check failed" >&2 + printf '%s\n' "Project $project check failed" >&2 return 1 fi @@ -165,7 +165,7 @@ project_action_helper() { if ! project_check "$project" then - env printf '%s\n' "Project $project check failed" >&2 + printf '%s\n' "Project $project check failed" >&2 return 1 fi @@ -221,11 +221,11 @@ project_action_arguments_verify_recursive() { if ! [ -z "$action_helper_arguments" ] then - test=$( env printf '%s\n' "$action_helper_arguments" | grep -P "^$argument$" || true ) + test=$( printf '%s\n' "$action_helper_arguments" | grep -P "^$argument$" || true ) if [ -z "$test" ] then - env printf '%s\n' "Invalid argument $argument for project $project action $action" >&2 + printf '%s\n' "Invalid argument $argument for project $project action $action" >&2 return 1 fi fi @@ -253,7 +253,7 @@ project_action_arguments_recursive() { ifs_save=$IFS IFS=$'\n' - for argument in $( env printf '%s\n' "$action_helper_arguments" ) + for argument in $( printf '%s\n' "$action_helper_arguments" ) do ( IFS=$ifs_save @@ -298,7 +298,7 @@ project_path() { local project_path="$root/$PROJECTS/$project" - env printf '%s\n' "$project_path" + printf '%s\n' "$project_path" } project_sources_path() { @@ -331,7 +331,7 @@ project_sources_path() { if ! [ -z "$sources_path" ] then - env printf '%s\n' "$sources_path" + printf '%s\n' "$sources_path" return fi @@ -340,7 +340,7 @@ project_sources_path() { if directory_filled_check "$path" then - env printf '%s\n' "$path" + printf '%s\n' "$path" return fi @@ -364,7 +364,7 @@ project_sources_path() { if ! [ -z "$sources_path" ] then - env printf '%s\n' "$sources_path" + printf '%s\n' "$sources_path" return fi } @@ -387,7 +387,7 @@ project_sources_directory_filled_error() { if ! [ -z "$sources_path" ] then - env printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" >&2 + printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) already exists" >&2 return 1 else return 0 @@ -403,7 +403,7 @@ project_sources_directory_missing_empty_error() { if [ -z "$sources_path" ] then - env printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf '%s\n' "Sources directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 return 1 else return 0 @@ -437,7 +437,7 @@ project_sources_archive() { if ! [ -z "$sources_archive" ] then - env printf '%s\n' "$sources_archive" + printf '%s\n' "$sources_archive" fi } @@ -449,7 +449,7 @@ project_sources_archive_extract() { local archive=$( project_sources_archive "$project" "$@" ) local destination=$( dirname "$archive" ) - env printf '%s\n' "Extracting source archive for $project (with ${arguments:-no argument})" + printf '%s\n' "Extracting source archive for $project (with ${arguments:-no argument})" file_verification_check "$archive" archive_extract "$archive" "$destination" @@ -470,7 +470,7 @@ project_sources_archive_update() { rm -rf "$sources_path" fi - env printf '%s\n' "Extracting source archive for $project (with ${arguments:-no argument})" + printf '%s\n' "Extracting source archive for $project (with ${arguments:-no argument})" file_verification_check "$archive" archive_extract "$archive" "$destination" @@ -484,7 +484,7 @@ project_sources_archive_missing_error() { local archive=$( project_sources_archive "$project" "$@" ) if [ -z "$archive" ] || ! [ -f "$archive" ] then - env printf '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" >&2 + printf '%s\n' "Missing sources archive for $project (with ${arguments:-no argument})" >&2 return 1 else return 0 @@ -529,12 +529,12 @@ project_blobs_path() { if [ -f "$blobs_path" ] then - env printf '%s\n' "$blobs_path" + printf '%s\n' "$blobs_path" return fi done - env printf '%s\n' "$blobs_path" + printf '%s\n' "$blobs_path" } project_blobs_ignore_path() { @@ -562,7 +562,7 @@ project_blobs_ignore_path() { if [ -f "$blobs_ignore_path" ] then - env printf '%s\n' "$blobs_ignore_path" + printf '%s\n' "$blobs_ignore_path" return fi done @@ -593,23 +593,23 @@ project_usage_actions() { local project=$1 shift - env printf '\n%s\n' 'Generic actions:' + printf '\n%s\n' 'Generic actions:' for action in $PROJECT_ACTIONS_GENERIC do if function_check "$action" then - env printf '%s\n' " $action" + printf '%s\n' " $action" fi done if [ $# -gt 0 ] then - env printf '\n%s\n' 'Specific actions:' + printf '\n%s\n' 'Specific actions:' for action in "$@" do - env printf '%s\n' " $action" + printf '%s\n' " $action" done fi } @@ -618,7 +618,7 @@ project_usage_arguments() { local project=$1 shift - env printf '\n%s\n' 'Arguments:' + printf '\n%s\n' 'Arguments:' project_usage_arguments_recursive "$project" " " "$@" } @@ -636,9 +636,9 @@ project_usage_arguments_recursive() { if ! [ -z "$action_helper_arguments" ] then - env printf '%s\n' "$action_helper_arguments" | while read argument + printf '%s\n' "$action_helper_arguments" | while read argument do - env printf '%s\n' "$spacing$argument" + printf '%s\n' "$spacing$argument" project_usage_arguments_recursive "$project" " $spacing" "$@" "$argument" done fi @@ -769,7 +769,7 @@ project_build_check() { while read rule do - source=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) source_path="$build_path/$source" # Source may contain a wildcard. @@ -796,7 +796,7 @@ project_build_path() { build_path="$build_path-$argument" done - env printf '%s\n' "$build_path" + printf '%s\n' "$build_path" } project_build_directory_missing_empty_error() { @@ -808,7 +808,7 @@ project_build_directory_missing_empty_error() { if ! directory_filled_check "$build_path" then - env printf '%s\n' "Build directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf '%s\n' "Build directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 return 1 else return 0 @@ -851,10 +851,10 @@ project_install() { while read rule do - source=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) source_path="$build_path/$source" - destination=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) destination_path="$install_path/$destination" destination_directory_path=$( dirname "$destination_path" ) @@ -892,10 +892,10 @@ project_install() { while read rule do - source=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) + source=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\1/g" ) source_path="$project_path/$INSTALL/$path/$source" - destination=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) destination_path="$install_path/$destination" destination_directory_path=$( dirname "$destination_path" ) @@ -945,7 +945,7 @@ project_install_check() { while read rule do - destination=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) destination_path="$install_path/$destination" if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] @@ -979,7 +979,7 @@ project_install_check() { while read rule do - destination=$( env printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) + destination=$( printf '%s\n' "$rule" | sed "s/$INSTALL_REGEX/\2/g" ) destination_path="$install_path/$destination" if ! [ -f "$destination_path" ] && ! [ -d "$destination_path" ] @@ -1002,7 +1002,7 @@ project_install_path() { install_path="$install_path-$argument" done - env printf '%s\n' "$install_path" + printf '%s\n' "$install_path" } project_install_directory_missing_empty_error() { @@ -1014,7 +1014,7 @@ project_install_directory_missing_empty_error() { if ! directory_filled_check "$install_path" then - env printf '%s\n' "Install directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 + printf '%s\n' "Install directory for project $project (with ${arguments:-no argument}) missing or empty" >&2 return 1 else return 0 @@ -1038,7 +1038,7 @@ project_release_path() { release_path="$release_path/$project" fi - env printf '%s\n' "$release_path" + printf '%s\n' "$release_path" } project_release_archive_path() { @@ -1058,7 +1058,7 @@ project_release_archive_path() { local archive_path="$release_path/$path.$TAR_XZ" - env printf '%s\n' "$archive_path" + printf '%s\n' "$archive_path" } project_release_rootfs_path() { @@ -1078,7 +1078,7 @@ project_release_rootfs_path() { local rootfs_path="$release_path/$path.$TAR_XZ" - env printf '%s\n' "$rootfs_path" + printf '%s\n' "$rootfs_path" } project_release_sources_archive_path() { @@ -1111,7 +1111,7 @@ project_release_sources_archive_path() { then local archive_path="$root/$RELEASE/$SOURCES/$project/$release_path.$TAR_XZ" - env printf '%s\n' "$archive_path" + printf '%s\n' "$archive_path" fi } @@ -1124,7 +1124,7 @@ project_release_sources_archive_create() { local archive_path=$( project_release_sources_archive_path "$project" "$@" ) local sources_path=$( project_sources_path "$project" "$repository" "$@" ) - env printf '%s\n' "Releasing sources archive for $project (with ${arguments:-no argument})" + printf '%s\n' "Releasing sources archive for $project (with ${arguments:-no argument})" archive_create "$archive_path" "$sources_path" file_verification_create "$archive_path" @@ -1199,7 +1199,7 @@ project_release_install() { local files=$( cd "$install_path" && find -type f || true ) local file - env printf '%s\n' "$files" | while read file + printf '%s\n' "$files" | while read file do path="$release_path/$file" directory_path=$( dirname "$path" ) @@ -1226,7 +1226,7 @@ project_release_install_check() { local files=$( cd "$install_path" && find -type f || true ) local file - env printf '%s\n' "$files" | while read file + printf '%s\n' "$files" | while read file do path="$release_path/$file" @@ -1262,7 +1262,7 @@ project_release_install_archive_create() { local install_path=$( project_install_path "$project" "$@" ) local archive_path=$( project_release_archive_path "$project" "$prefix" "$@" ) - env printf '%s\n' "Releasing $prefix archive for $project (with ${arguments:-no argument})" + printf '%s\n' "Releasing $prefix archive for $project (with ${arguments:-no argument})" archive_create "$archive_path" "$install_path" file_verification_create "$archive_path" @@ -1310,7 +1310,7 @@ project_release_install_rootfs_create() { local install_path=$( project_install_path "$project" "$@" ) local rootfs_path=$( project_release_rootfs_path "$project" "$prefix" "$@" ) - env printf '%s\n' "Releasing $prefix rootfs for $project (with ${arguments:-no argument})" + printf '%s\n' "Releasing $prefix rootfs for $project (with ${arguments:-no argument})" rootfs_create "$rootfs_path" "$install_path" file_verification_create "$rootfs_path" @@ -1421,7 +1421,7 @@ project_file_path() { return 1 fi - env printf '%s\n' "$file_path" + printf '%s\n' "$file_path" } project_file_test() { @@ -17,7 +17,7 @@ TOOL_ACTIONS_GENERIC="usage update execute" TOOL_ACTIONS_HELPERS="arguments" -TOOL_FUNCTIONS=$( for action in $TOOL_ACTIONS_GENERIC ; do env printf '%s\n' "$action" "$action""_check" ; done ; env printf '%s\n' "$TOOL_ACTIONS_HELPERS" ) +TOOL_FUNCTIONS=$( for action in $TOOL_ACTIONS_GENERIC ; do printf '%s\n' "$action" "$action""_check" ; done ; printf '%s\n' "$TOOL_ACTIONS_HELPERS" ) tool_include() { local tool=$1 @@ -79,7 +79,7 @@ tool_action() { if ! tool_check "$tool" then - env printf '%s\n' "Tool $tool check failed" >&2 + printf '%s\n' "Tool $tool check failed" >&2 return 1 fi @@ -97,7 +97,7 @@ tool_action() { return 0 fi - env printf '%s\n' "Tool $tool $action (with ${arguments:-no argument})" >&2 + printf '%s\n' "Tool $tool $action (with ${arguments:-no argument})" >&2 ( set -e @@ -106,10 +106,10 @@ tool_action() { if [ $? -ne 0 ] then - env printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) failed" >&2 + printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) failed" >&2 return 1 else - env printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) completed" >&2 + printf '\n%s\n' "Tool $tool $action (with ${arguments:-no argument}) completed" >&2 fi ) } @@ -125,7 +125,7 @@ tool_action_check() { if ! tool_check "$tool" then - env printf '%s\n' "Tool $tool check failed" >&2 + printf '%s\n' "Tool $tool check failed" >&2 return 1 fi @@ -162,7 +162,7 @@ tool_action_helper() { if ! tool_check "$tool" then - env printf '%s\n' "Tool $tool check failed" >&2 + printf '%s\n' "Tool $tool check failed" >&2 return 1 fi @@ -193,7 +193,7 @@ tool_action_arguments_recursive() { then tool_action "$action" "$tool" "$@" else - env printf '%s\n' "$action_helper_arguments" | while read argument + printf '%s\n' "$action_helper_arguments" | while read argument do tool_action_arguments_recursive "$action" "$tool" "$@" "$argument" done @@ -205,7 +205,7 @@ tool_path() { local tool_path="$root/$TOOLS/$tool" - env printf '%s\n' "$tool_path" + printf '%s\n' "$tool_path" } tool_sources_path() { @@ -224,7 +224,7 @@ tool_sources_path() { if directory_filled_check "$path" then - env printf '%s\n' "$path" + printf '%s\n' "$path" return fi done @@ -234,23 +234,23 @@ tool_usage_actions() { local tool=$1 shift - env printf '\n%s\n' 'Generic actions:' + printf '\n%s\n' 'Generic actions:' for action in $TOOL_ACTIONS_GENERIC do if function_check "$action" then - env printf '%s\n' " $action" + printf '%s\n' " $action" fi done if [ $# -gt 0 ] then - env printf '\n%s\n' 'Specific actions:' + printf '\n%s\n' 'Specific actions:' for action in "$@" do - env printf '%s\n' " $action" + printf '%s\n' " $action" done fi } @@ -259,7 +259,7 @@ tool_usage_arguments() { local tool=$1 shift - env printf '\n%s\n' 'Arguments:' + printf '\n%s\n' 'Arguments:' tool_usage_arguments_recursive "$tool" " " "$@" } @@ -275,9 +275,9 @@ tool_usage_arguments_recursive() { if ! [ -z "$action_helper_arguments" ] then - env printf '%s\n' "$action_helper_arguments" | while read argument + printf '%s\n' "$action_helper_arguments" | while read argument do - env printf '%s\n' "$spacing$argument" + printf '%s\n' "$spacing$argument" tool_usage_arguments_recursive "$tool" " $spacing" "$@" "$argument" done fi @@ -316,7 +316,7 @@ tool_file_path() { return 1 fi - env printf '%s\n' "$file_path" + printf '%s\n' "$file_path" } tool_file_test() { diff --git a/projects/cros-scripts/install/cros-boot-keys b/projects/cros-scripts/install/cros-boot-keys index dffdc9b9..bd60a4e2 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() { - env printf '%s\n' "$executable [action]" >&2 + printf '%s\n' "$executable [action]" >&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 '\n%s\n' 'Actions:' >&2 + printf '%s\n' ' generate - Generate a set of keys' >&2 + printf '%s\n' ' verify - Verify keyblocks' >&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 + 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 } keys_override_confirm() { @@ -68,9 +68,9 @@ keys_override_confirm() { return 0 fi - 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: ' + printf '%s\n' 'This is going to override keys stored in the following directory:' + printf '%s\n' " $VBOOT_KEYS_PATH" + printf '%s' 'Press enter to confirm: ' read confirm } @@ -89,8 +89,8 @@ generate() { for key in $KEYS do - algorithm=$( env printf '%s\n' "$algorithms" | sed "s/$REGEXP/\1/g" ) - algorithms=$( env printf '%s\n' "$algorithms" | sed "s/$REGEXP/\2/g" ) + algorithm=$( printf '%s\n' "$algorithms" | sed "s/$REGEXP/\1/g" ) + algorithms=$( 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 - env printf '\n%s\n' "Generated keys $KEYS" + printf '\n%s\n' "Generated keys $KEYS" for keyblock in $KEYBLOCKS do - 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" ) + pubkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" ) + subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" ) + privkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" ) + subkeys=$( printf '%s\n' "$subkeys" | 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" ) + mode=$( printf '%s\n' "$modes" | sed "s/$REGEXP/\1/g" ) + modes=$( 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 - env printf '\n%s\n' "Generated keyblocks $KEYBLOCKS" + printf '\n%s\n' "Generated keyblocks $KEYBLOCKS" } verify() { @@ -130,15 +130,15 @@ verify() { for keyblock in $KEYBLOCKS do - 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" ) + pubkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" ) + subkeys=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\2/g" ) + privkey=$( printf '%s\n' "$subkeys" | sed "s/$REGEXP/\1/g" ) + subkeys=$( 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 - env printf '\n%s\n' "Verified keyblocks $KEYBLOCKS" + printf '\n%s\n' "Verified keyblocks $KEYBLOCKS" } requirements() { @@ -151,7 +151,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + 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 d2e15f29..ad10e5c9 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() { - env printf '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]" >&2 + printf '%s\n' "$executable [action] [firmware image] [gbb action|vpd action] [gbb file|gbb flag|vpd file]" >&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 '\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 - 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 '\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 - env printf '\n%s\n' 'GBB flags:' >&2 + printf '\n%s\n' 'GBB flags:' >&2 for flag in $GBB_FLAGS do - env printf '%s\n' " $flag" >&2 + printf '%s\n' " $flag" >&2 done - 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 '\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 - 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 + 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 } 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" - env printf '\n%s\n' "Signed firmwares image $firmware_image_path" + 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" || ( env printf '\n%s\n' "Bad firmware image signature!" >&2 && return 1 ) + futility verify -k "$VBOOT_KEYS_PATH/root_key.$VBPUBK" "$firmware_image_path" || ( printf '\n%s\n' "Bad firmware image signature!" >&2 && return 1 ) - env printf '\n%s\n' "Verified firmware image $firmware_image_path" + 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" - env printf '\n%s\n' "Extracted GBB from $firmware_image_path to $gbb_file_path" + 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" - env printf '\n%s\n' "Replaced GBB from $gbb_file_path to $firmware_image_path" + printf '\n%s\n' "Replaced GBB from $gbb_file_path to $firmware_image_path" ;; "list") - env printf '%s\n' "GBB flags in $firmware_image_path:" + 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 - env printf '%s\n' " $flag" + printf '%s\n' " $flag" fi i=$(( $i + 1 )) @@ -134,15 +134,15 @@ gbb() { if [ -z "$flag_value" ] then - env printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 + printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 exit 1 fi - flags=$( env printf "0x%x\n" $(( $flags | $flag_value )) ) + flags=$( printf "0x%x\n" $(( $flags | $flag_value )) ) gbb_flags_set "$firmware_image_path" "$flags" - env printf '\n%s\n' "Enabled GBB flag $gbb_flag in $firmware_image_path" + 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 - env printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 + printf '%s\n' "Invalid GBB flag: $gbb_flag" >&2 exit 1 fi - flags=$( env printf "0x%x\n" $(( $flags & ~$flag_value )) ) + flags=$( printf "0x%x\n" $(( $flags & ~$flag_value )) ) gbb_flags_set "$firmware_image_path" "$flags" - env printf '\n%s\n' "Disabled GBB flag $gbb_flag in $firmware_image_path" + 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 - env printf '%d\n' $(( 1 << $i )) + 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" - env printf '\n%s\n' "Extracted VPD from $firmware_image_path to $vpd_file_path" + 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" - env printf '\n%s\n' "Replaced VPD from $vpd_file_path to $firmware_image_path" + 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 - env printf '%s\n' "Missing requirement: $requirement" >&2 + 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 e45915e9..37575e6b 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() { - env printf '%s\n' "$executable [action] [storage] [kernel image|kernel modules]" >&2 + printf '%s\n' "$executable [action] [storage] [kernel image|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 + 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 usage_storage - 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 + 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 } usage_storage() { - env printf '\n%s\n' 'Storage:' >&2 + printf '\n%s\n' 'Storage:' >&2 local nodes=$( ls "$SYS_BLOCK_PATH" ) local node_path @@ -58,7 +58,7 @@ usage_storage() { continue fi - env printf '%s\n' " $node_path - $name" >&2 + printf '%s\n' " $node_path - $name" >&2 done } @@ -68,9 +68,9 @@ storage_affect_confirm() { local name=$( storage_name "$storage_path" ) local 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: ' + printf '%s\n' 'This is going to affect the following storage:' + printf '%s\n' " $storage_path - $name" + printf '%s' 'Press enter to confirm: ' read confirm } @@ -95,17 +95,17 @@ storage_name() { return 0 fi - name=$( env printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + name=$( printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) if [ -f "$vendor_path" ] then vendor=$( cat "$vendor_path" ) - vendor=$( env printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + vendor=$( printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) name="$vendor $name" fi - env printf '%s\n' "$name" + printf '%s\n' "$name" } storage_partition_path() { @@ -124,7 +124,7 @@ storage_partition_path() { return 1 fi - env printf '%s\n' "$storage_partition_path" + 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" ) - env printf '%s\n' "$storage_partition_mount_path" + printf '%s\n' "$storage_partition_mount_path" } storage_kernel_path() { @@ -155,13 +155,13 @@ backup() { if [ -z "$storage_kernel_path" ] then - env printf '%s\n' "No kernel partition found on storage $storage_path" >&2 + printf '%s\n' "No kernel partition found on storage $storage_path" >&2 return 1 fi cat "$storage_kernel_path" > "$kernel_image_path" - env printf '\n%s\n' "Backed up kernel image to $kernel_image_path" + printf '\n%s\n' "Backed up kernel image to $kernel_image_path" } image() { @@ -172,7 +172,7 @@ image() { if [ -z "$storage_kernel_path" ] then - env printf '%s\n' "No kernel partition found on storage $storage_path" >&2 + 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 - env printf '\n%s\n' "Installed kernel image on storage $storage_path" + printf '\n%s\n' "Installed kernel image on storage $storage_path" } modules() { @@ -192,7 +192,7 @@ modules() { if [ -z "$storage_rootfs_path" ] then - env printf '%s\n' "No rootfs partition found on storage $storage_path" >&2 + 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" - env printf '\n%s\n' "Installed kernel modules on storage $storage_path" + printf '\n%s\n' "Installed kernel modules on storage $storage_path" } requirements() { @@ -221,7 +221,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + 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 e1c7cacb..bfd667c0 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() { - env printf '%s\n' "$executable [action] [kernel files|kernel image] [medium]" >&2 + printf '%s\n' "$executable [action] [kernel files|kernel image] [medium]" >&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 '\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 - 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 '\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 - 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 + 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 } 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" - env printf '\n%s\n' "Packed kernel image $kernel_image_path" + 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" - env printf '\n%s\n' "Signed kernel image $kernel_image_path" + 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" - env printf '\n%s\n' "Verified kernel image $kernel_image_path" + printf '\n%s\n' "Verified kernel image $kernel_image_path" } requirements() { @@ -88,7 +88,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + 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 b33c6744..b50fad76 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() { - env printf '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]" >&2 + printf '%s\n' "$executable [action] [storage] [rootfs tarball|kernel files] [medium]" >&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 + 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 usage_storage - 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 + 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 } usage_storage() { - env printf '\n%s\n' 'Storage:' >&2 + printf '\n%s\n' 'Storage:' >&2 local nodes=$( ls "$SYS_BLOCK_PATH" ) local node_path @@ -67,7 +67,7 @@ usage_storage() { continue fi - env printf '%s\n' " $node_path - $name" >&2 + printf '%s\n' " $node_path - $name" >&2 done } @@ -77,9 +77,9 @@ storage_affect_confirm() { local name=$( storage_name "$storage_path" ) local 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: ' + printf '%s\n' 'This is going to affect the following storage:' + printf '%s\n' " $storage_path - $name" + printf '%s' 'Press enter to confirm: ' read confirm } @@ -104,17 +104,17 @@ storage_name() { return 0 fi - name=$( env printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + name=$( printf '%s\n' "$name" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) if [ -f "$vendor_path" ] then vendor=$( cat "$vendor_path" ) - vendor=$( env printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) + vendor=$( printf '%s\n' "$vendor" | sed -e "s/^[[:space:]]*//;s/[[:space:]]*$//" ) name="$vendor $name" fi - env printf '%s\n' "$name" + printf '%s\n' "$name" } storage_partition_path() { @@ -133,7 +133,7 @@ storage_partition_path() { return 1 fi - env printf '%s\n' "$storage_partition_path" + 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" ) - env printf '%s\n' "$storage_partition_mount_path" + printf '%s\n' "$storage_partition_mount_path" } partitions() { @@ -161,7 +161,7 @@ partitions() { udisksctl unmount -b "$partition" || true done - ( env printf '%s\n' "g" ; env printf '%s\n' "w" ) | fdisk "$storage_path" + ( printf '%s\n' "g" ; printf '%s\n' "w" ) | fdisk "$storage_path" cgpt create "$storage_path" @@ -180,7 +180,7 @@ partitions() { mkfs.ext4 -F "$storage_rootfs_path" - env printf '\n%s\n' "Setup partitions on storage $storage_path" + printf '\n%s\n' "Setup partitions on storage $storage_path" } rootfs() { @@ -201,7 +201,7 @@ rootfs() { udisksctl unmount -b "$storage_rootfs_path" - env printf '\n%s\n' "Installed rootfs on storage $storage_path" + printf '\n%s\n' "Installed rootfs on storage $storage_path" } kernel() { @@ -230,7 +230,7 @@ kernel() { udisksctl unmount -b "$storage_rootfs_path" - env printf '\n%s\n' "Installed kernel on storage $storage_path" + printf '\n%s\n' "Installed kernel on storage $storage_path" } requirements() { @@ -243,7 +243,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + printf '%s\n' "Missing requirement: $requirement" >&2 exit 1 fi done diff --git a/projects/crossgcc/crossgcc b/projects/crossgcc/crossgcc index 1fa3b041..67a1c52e 100755 --- a/projects/crossgcc/crossgcc +++ b/projects/crossgcc/crossgcc @@ -52,7 +52,7 @@ extract() { if [ -f "$tarball_sources_path" ] && ! [ -f "$tarball_install_path" ] then - env printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})" + 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 - env printf '%s\n' "Copying source archive $tarball for $project (with ${arguments:-no argument})" + 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") - env printf '%s\n' "$build_path/bin/arm-eabi-" + printf '%s\n' "$build_path/bin/arm-eabi-" ;; esac } @@ -180,7 +180,7 @@ release() { if [ -f "$tarball_install_path" ] && ! [ -f "$tarball_release_path" ] then - env printf '%s\n' "Releasing source archive $tarball for $project (with ${arguments:-no argument})" + 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 a3d11ddf..557b6fc6 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$//" ) - env printf '%s\n' "$tarballs" + printf '%s\n' "$tarballs" } crossgcc_tarball_sources_path() { @@ -28,7 +28,7 @@ crossgcc_tarball_sources_path() { local tarball_sources_path="$root/$SOURCES/$tarball" - env printf '%s\n' "$tarball_sources_path" + 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" - env printf '%s\n' "$tarball_install_path" + 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" - env printf '%s\n' "$tarball_release_path" + printf '%s\n' "$tarball_release_path" } diff --git a/projects/libreboot-release/install/libreboot-release b/projects/libreboot-release/install/libreboot-release index 28674391..58a384f0 100644 --- a/projects/libreboot-release/install/libreboot-release +++ b/projects/libreboot-release/install/libreboot-release @@ -27,18 +27,18 @@ SHA256SUM="sha256sum" ASC="asc" usage() { - 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 + 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 } download() { @@ -76,7 +76,7 @@ download() { wget -O "$path.$SHA256SUM" "$url.$SHA256SUM" wget -O "$path.$ASC" "$url.$ASC" - env printf '\n%s\n' "Downloaded $project" + printf '\n%s\n' "Downloaded $project" return 0 fi @@ -85,7 +85,7 @@ download() { IFS=$ifs_save done - env printf '%s\n' "Could not download $project from $DOWNLOAD_URL" >&2 + 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" - env printf '\n%s\n' "Downloaded $project sources" + printf '\n%s\n' "Downloaded $project sources" else - env printf '%s\n' "Could not download $project sources from $DOWNLOAD_URL" >&2 + 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 - env printf '%s\n' "Could not verify $project checksum!" >&2 + printf '%s\n' "Could not verify $project checksum!" >&2 fi if [ -f "$signature_path" ] then gpg --armor --verify "$signature_path" "$path" else - env printf '%s\n' "Could not verify $project signature!" >&2 + printf '%s\n' "Could not verify $project signature!" >&2 fi - env printf '\n%s\n' "Verified $project" + printf '\n%s\n' "Verified $project" return 0 done @@ -171,7 +171,7 @@ verify() { IFS=$ifs_save done - env printf '%s\n' "Could not verify $project" >&2 + printf '%s\n' "Could not verify $project" >&2 return 1 } @@ -209,7 +209,7 @@ extract() { if [ "$prefix" = "$SYSTEMS/$MACHINE" ] then - env printf '%s\n' "Skiping $project extract" + printf '%s\n' "Skiping $project extract" return 0 fi @@ -217,7 +217,7 @@ extract() { tar -xf "$path" -ps -C "$extract_path" - env printf '%s\n' "Extracted $project" + printf '%s\n' "Extracted $project" return 0 done @@ -225,7 +225,7 @@ extract() { IFS=$ifs_save done - env printf '%s\n' "Could not extract $project" >&2 + printf '%s\n' "Could not extract $project" >&2 return 1 } @@ -239,7 +239,7 @@ requirements() { if [ -z "$requirement_path" ] then - env printf '%s\n' "Missing requirement: $requirement" >&2 + printf '%s\n' "Missing requirement: $requirement" >&2 exit 1 fi done @@ -256,7 +256,7 @@ setup() { if [ -z "$DOWNLOAD_URL" ] then - env printf '%s\n' 'Missing download URL' >&2 + 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 9d8536ef..e85d3c22 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() { - env printf '%s\n' "$executable [action] [sources path] (extract path)" >&2 + printf '%s\n' "$executable [action] [sources path] (extract path)" >&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%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 - env printf '\n%s\n' ' When no extract path is provided, sources are extracted in the current' - env printf '%s\n' ' directory.' + printf '\n%s\n' ' When no extract path is provided, sources are extracted in the current' + 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 - env printf '%s\n' "Finding $BUILD_SYSTEM sources archive failed!" >&2 + printf '%s\n' "Finding $BUILD_SYSTEM sources archive failed!" >&2 usage exit 1 fi tar -xf "$archive" -ps -C "$extract_path" - env printf '\n%s\n' "Extracted $BUILD_SYSTEM sources from $sources_path to $extract_path" + 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 - env printf '\n%s\n' "Copied $BUILD_SYSTEM sources from $sources_path to $extract_path" + 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 - env printf '%s\n' "Missing requirement: $requirement" >&2 + 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 259cb10a..7d604740 100755 --- a/projects/libreboot-sources/libreboot-sources +++ b/projects/libreboot-sources/libreboot-sources @@ -38,8 +38,8 @@ release() { project_release_install "$project" "$TOOLS" "$@" - env printf '%s\n' "$VERSION" > "$sources_path/$DOTVERSION" - env printf '%s\n' "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH" + printf '%s\n' "$VERSION" > "$sources_path/$DOTVERSION" + printf '%s\n' "$SOURCE_DATE_EPOCH" > "$sources_path/$DOTEPOCH" if git_check "$sources_path" then diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index c5f391a4..59b78f42 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -22,7 +22,7 @@ arguments() { then ls -A "$root/$PROJECTS/" | while read project do - env printf '%s\n' "$project" + printf '%s\n' "$project" done else shift @@ -93,18 +93,18 @@ verify() { ( IFS=$ifs_save - env printf '\n%s\n' "Discovered blob: $file" + printf '\n%s\n' "Discovered blob: $file" $EDITOR "$project_sources_path/$file" - env printf '%s' "Type \"blob\" to keep or press enter to discard: " + printf '%s' "Type \"blob\" to keep or press enter to discard: " read choice if [ "$choice" = "blob" ] then - env printf '%s\n' "$file" >> "$project_blobs_path" + printf '%s\n' "$file" >> "$project_blobs_path" else - env printf '%s\n' "$file" >> "$project_blobs_ignore_path" + printf '%s\n' "$file" >> "$project_blobs_ignore_path" fi sed "\|^$file$|d" -i "$project_blobs_discover_path" @@ -151,13 +151,13 @@ execute() { git_clean "$repository_path" fi - env printf '\n%s\n' 'Discovering new blobs, this may take a while...' + printf '\n%s\n' 'Discovering new blobs, this may take a while...' files=$( find "$project_sources_path" -type f | grep -vP "\.git/|\.tar|\.patch" ) touch "$project_blobs_discover_path" - env printf '%s\n' "$files" | while read file + printf '%s\n' "$files" | while read file do if ! [ -z "$project_blobs_ignore_path" ] then @@ -171,11 +171,11 @@ execute() { match=$( "$deblob_check_path" -l -i "" "$file" || true ) if ! [ -z "$match" ] then - env printf '%s\n' "$match" >> "$project_blobs_discover_path" + printf '%s\n' "$match" >> "$project_blobs_discover_path" fi done - env printf '\n%s\n' "Discovered blobs were stored in $project_blobs_discover_path" + printf '\n%s\n' "Discovered blobs were stored in $project_blobs_discover_path" } execute_check() { diff --git a/tools/boot-keys/boot-keys b/tools/boot-keys/boot-keys index c79bac2b..ddc0273a 100755 --- a/tools/boot-keys/boot-keys +++ b/tools/boot-keys/boot-keys @@ -24,7 +24,7 @@ generate() { if [ -z "$type" ] then - env printf '%s\n' 'Unable to determine keys type' >&2 + printf '%s\n' 'Unable to determine keys type' >&2 return 1 fi @@ -47,11 +47,11 @@ sign() { if [ -z "$type" ] then - env printf '%s\n' 'Unable to determine keys type' >&2 + printf '%s\n' 'Unable to determine keys type' >&2 return 1 fi - env printf '%s\n' "$prepare_files" | while read install_path + printf '%s\n' "$prepare_files" | while read install_path do case $type in "cros-firmware") @@ -90,11 +90,11 @@ verify() { if [ -z "$type" ] then - env printf '%s\n' 'Unable to determine keys type' >&2 + printf '%s\n' 'Unable to determine keys type' >&2 return 1 fi - env printf '%s\n' "$prepare_files" | while read install_path + printf '%s\n' "$prepare_files" | while read install_path do case $type in "cros-firmware") diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper index 05739bbe..d386c8ba 100755 --- a/tools/boot-keys/boot-keys-helper +++ b/tools/boot-keys/boot-keys-helper @@ -15,7 +15,7 @@ boot_keys_cros() { if ! [ -x "$cros_script_path" ] then - env printf '%s' "$cros_script script missing from cros-scripts install" >&2 + printf '%s' "$cros_script script missing from cros-scripts install" >&2 return 1 fi @@ -45,7 +45,7 @@ boot_keys_files_install_path() { ifs_save=$IFS IFS=$'\n' - for argument in $( env printf '%s\n' "$helper_arguments" ) + for argument in $( printf '%s\n' "$helper_arguments" ) do ( IFS=$ifs_save |