From 46c6ca3b9ee3e545a41b3b0f488885b20a1c65b5 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Thu, 22 Jun 2017 11:44:19 -0400 Subject: Fixed printf calls & replaced 'echo' w/ printf. All printf calls should now be properly formatted; prior, the format specifier string was erroneously used for both the format specifiers and the string to be printed. 'env' is now used to locate the printf binary so as to avoid potentially using a shell builtin. Lastly, all calls to 'echo' within the new build system have been replaced with printf for consistency/portability purposes. --- .../libreboot-release/install/libreboot-release | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'projects/libreboot-release') 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 } -- cgit v1.2.3-70-g09d2