diff options
author | Swift Geek <swiftgeek@gmail.com> | 2017-10-29 04:46:17 +0000 |
---|---|---|
committer | Gogs <gogitservice@gmail.com> | 2017-10-29 04:46:17 +0000 |
commit | 5ff0c88449bb5bf03e4e38246565d3272fca1db5 (patch) | |
tree | e86f14dfddc867e8a8abdfa31713edcc2cf87c3d /tools | |
parent | bedc62fdada9e0e7a67b82153b186689dda07145 (diff) | |
parent | 5c1fe562d8044249f5830df826544bc72ecb41b2 (diff) | |
download | librebootfr-5ff0c88449bb5bf03e4e38246565d3272fca1db5.tar.gz librebootfr-5ff0c88449bb5bf03e4e38246565d3272fca1db5.zip |
Merge branch 'readability-changes' of kragle/libreboot into master
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/blobs-discover/blobs-discover | 60 | ||||
-rwxr-xr-x | tools/boot-keys/boot-keys | 28 | ||||
-rwxr-xr-x | tools/boot-keys/boot-keys-helper | 16 |
3 files changed, 52 insertions, 52 deletions
diff --git a/tools/blobs-discover/blobs-discover b/tools/blobs-discover/blobs-discover index 6d143d02..7e383942 100755 --- a/tools/blobs-discover/blobs-discover +++ b/tools/blobs-discover/blobs-discover @@ -18,7 +18,7 @@ arguments() { local project=$1 - if [ -z "$project" ] + if [[ -z "$project" ]] then ls -A "$root/$PROJECTS/" | while read project do @@ -36,8 +36,8 @@ usage() { } update() { - local tool_path=$( tool_path "$tool" ) - local sources_path=$( tool_sources_path "$tool" ) + local tool_path=$(tool_path "$tool") + local sources_path=$(tool_sources_path "$tool") local deblob_check_path="$sources_path/deblob-check" local patches_path="$tool_path/$PATCHES/$WILDDOTPATCH" @@ -50,7 +50,7 @@ update() { path_wildcard_expand "$patches_path" | while read patch_path do - if ! [ -f "$patch_path" ] + if ! [[ -f "$patch_path" ]] then continue fi @@ -63,10 +63,10 @@ verify() { local project=$1 shift - local project_path=$( project_path "$project" ) - local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local project_path=$(project_path "$project") + local project_sources_path=$(project_sources_path "$project" "$repository" "$@") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_discover_path local ifs_save @@ -75,9 +75,9 @@ verify() { requirements "sort" - if ! [ -z "$project_blobs_path" ] + if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi @@ -88,7 +88,7 @@ verify() { ifs_save=$IFS IFS=$'\n' - for file in $( cat "$project_blobs_discover_path" ) + for file in $(cat "$project_blobs_discover_path") do ( IFS=$ifs_save @@ -100,7 +100,7 @@ verify() { printf '%s' "Type \"blob\" to keep or press enter to discard: " read choice - if [ "$choice" = "blob" ] + if [[ "$choice" = "blob" ]] then printf '%s\n' "$file" >> "$project_blobs_path" else @@ -124,21 +124,21 @@ execute() { shift local repository=$project - local repository_path=$( git_project_repository_path "$repository" ) + local repository_path=$(git_project_repository_path "$repository") # This assumes that the repository is the project, which is not always the case. project_sources_directory_missing_empty_error "$project" "$repository" - local sources_path=$( tool_sources_path "$tool" ) - local project_path=$( project_path "$project" ) - local project_sources_path=$( project_sources_path "$project" "$repository" "$@" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local sources_path=$(tool_sources_path "$tool") + local project_path=$(project_path "$project") + local project_sources_path=$(project_sources_path "$project" "$repository" "$@") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_directory_path - if ! [ -z "$project_blobs_path" ] + if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi @@ -153,23 +153,23 @@ execute() { printf '\n%s\n' 'Discovering new blobs, this may take a while...' - files=$( find "$project_sources_path" -type f | grep -vP "\.git/|\.tar|\.patch" ) + files=$(find "$project_sources_path" -type f | grep -vP "\.git/|\.tar|\.patch") touch "$project_blobs_discover_path" printf '%s\n' "$files" | while read file do - if ! [ -z "$project_blobs_ignore_path" ] + if [[ -n "$project_blobs_ignore_path" ]] then match=$( grep "$file" "$project_blobs_ignore_path" || true) - if [ ! -z "$match" ] + if [[ ! -z "$match" ]] then continue fi fi - match=$( "$deblob_check_path" -l -i "" "$file" || true ) - if ! [ -z "$match" ] + match=$("$deblob_check_path" -l -i "" "$file" || true) + if [[ -n "$match" ]] then printf '%s\n' "$match" >> "$project_blobs_discover_path" fi @@ -182,14 +182,14 @@ execute_check() { local project=$1 shift - local project_path=$( project_path "$project" ) - local project_blobs_path=$( project_blobs_path "$project" "$@" ) - local project_blobs_ignore_path=$( project_blobs_ignore_path "$project" "$@" ) + local project_path=$(project_path "$project") + local project_blobs_path=$(project_blobs_path "$project" "$@") + local project_blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") local project_blobs_discover_path - if ! [ -z "$project_blobs_path" ] + if [[ -n "$project_blobs_path" ]] then - project_blobs_discover_path="$( dirname $project_blobs_path )/$BLOBS_DISCOVER" + project_blobs_discover_path="$(dirname $project_blobs_path)/$BLOBS_DISCOVER" else project_blobs_discover_path="$project_path/$CONFIGS/$BLOBS_DISCOVER" fi diff --git a/tools/boot-keys/boot-keys b/tools/boot-keys/boot-keys index da56aca9..4c40bdf3 100755 --- a/tools/boot-keys/boot-keys +++ b/tools/boot-keys/boot-keys @@ -20,11 +20,11 @@ usage() { } generate() { - local type=$( boot_keys_type "$@" ) + local type=$(boot_keys_type "$@") - if [ -z "$type" ] + if [[ -z "$type" ]] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi @@ -38,16 +38,16 @@ generate() { sign() { local project=$1 - local prepare_files=$( boot_keys_files "$@" ) - local type=$( boot_keys_type "$@" ) + local prepare_files=$(boot_keys_files "$@") + local type=$(boot_keys_type "$@") local install_path local firmware_path local kernel_path local media - if [ -z "$type" ] + if [[ -z "$type" ]] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi @@ -60,13 +60,13 @@ sign() { boot_keys_cros "$type-prepare" "sign" "$firmware_path" ;; "cros-kernel") - media=$( project_action "media" "$@" ) + media=$(project_action "media" "$@") for medium in $media do kernel_path="$install_path/$KERNEL-$medium.$IMG" - if [ -f "$kernel_path" ] + if [[ -f "$kernel_path" ]] then boot_keys_cros "$type-prepare" "sign" "$kernel_path" else @@ -81,16 +81,16 @@ sign() { verify() { local project=$1 - local prepare_files=$( boot_keys_files "$@" ) - local type=$( boot_keys_type "$@" ) + local prepare_files=$(boot_keys_files "$@") + local type=$(boot_keys_type "$@") local install_path local firmware_path local kernel_path local media - if [ -z "$type" ] + if [[ -z "$type" ]] then - printf '%s\n' 'Unable to determine keys type' >&2 + printf 1>&2 '%s\n' 'Unable to determine keys type' return 1 fi @@ -103,7 +103,7 @@ verify() { boot_keys_cros "$type-prepare" "verify" "$firmware_path" ;; "cros-kernel") - media=$( project_action "media" "$@" ) + media=$(project_action "media" "$@") for medium in $media do diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper index 31e2c16b..464638b9 100755 --- a/tools/boot-keys/boot-keys-helper +++ b/tools/boot-keys/boot-keys-helper @@ -9,13 +9,13 @@ boot_keys_cros() { local cros_script=$1 shift - local vboot_tools_path=$( project_install_path "vboot" "tools" ) - local cros_scripts_path=$( project_install_path "cros-scripts" ) + local vboot_tools_path=$(project_install_path "vboot" "tools") + local cros_scripts_path=$(project_install_path "cros-scripts") local cros_script_path="$cros_scripts_path/$cros_script" - if ! [ -x "$cros_script_path" ] + if ! [[ -x "$cros_script_path" ]] then - printf '%s' "$cros_script script missing from cros-scripts install" >&2 + printf 1>&2 '%s' "$cros_script script missing from cros-scripts install" return 1 fi @@ -34,10 +34,10 @@ boot_keys_files_install_path() { local argument local ifs_save - helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + helper_arguments=$(project_action_helper "arguments" "$project" "$@") - if [ $? -ne 0 ] || [ -z "$helper_arguments" ] + if [[ $? -ne 0 ]] || [[ -z "$helper_arguments" ]] then project_install_path "$project" "$@" else @@ -45,7 +45,7 @@ boot_keys_files_install_path() { ifs_save=$IFS IFS=$'\n' - for argument in $( printf '%s\n' "$helper_arguments" ) + for argument in $(printf '%s\n' "$helper_arguments") do ( IFS=$ifs_save @@ -63,7 +63,7 @@ boot_keys_files() { local project=$1 shift - local cros_scripts_path=$( project_install_path "cros-scripts" ) + local cros_scripts_path=$(project_install_path "cros-scripts") local cros_boot_keys="$cros_scripts_path/cros-boot-keys" project_action_arguments_verify_recursive "install" "$project" "$@" |