aboutsummaryrefslogtreecommitdiff
path: root/libs/common
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 /libs/common
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 'libs/common')
-rwxr-xr-xlibs/common20
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/common b/libs/common
index 513d697c..bcae2a9d 100755
--- a/libs/common
+++ b/libs/common
@@ -60,7 +60,7 @@ arguments_list() {
for argument in "$@"
do
- echo "$argument"
+ env printf '%s\n' "$argument"
done
}
@@ -85,7 +85,7 @@ path_wildcard_expand() {
local path=$@
# Evaluation fails with unescaped whitespaces.
- path=$( echo "$path" | sed "s/ /\\\ /g" )
+ path=$( env printf '%s\n' "$path" | sed "s/ /\\\ /g" )
eval "arguments_list "$path""
}
@@ -112,7 +112,7 @@ file_checksum_check() {
if ! [ -f "$checksum_path" ]
then
- printf "Could not verify file checksum!\n" >&2
+ env printf '%s\n' 'Could not verify file checksum!' >&2
return 1
fi
@@ -142,7 +142,7 @@ file_signature_check() {
if ! [ -f "$signature_path" ]
then
- printf "Could not verify file signature!\n" >&2
+ env printf '%s\n' 'Could not verify file signature!' >&2
return 1
fi
@@ -336,7 +336,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
@@ -353,7 +353,7 @@ requirements_root() {
if [ -z "$requirement_path" ]
then
- printf "Missing requirement: $requirement\n" >&2
+ env printf '%s\n' "Missing requirement: $requirement" >&2
exit 1
fi
done
@@ -375,22 +375,22 @@ arguments_concat() {
fi
done
- echo "$concat"
+ env printf '%s\n' "$concat"
}
execute_root() {
local sudo=$( which sudo 2> /dev/null || true )
local arguments
- printf "Running command as root: " >&2
- echo "$@" >&2
+ env printf '%s' 'Running command as root: ' >&2
+ env printf '%b\n' "$*" >&2
if ! [ -z "$sudo" ]
then
sudo "$@"
else
# Quote arguments for eval through su.
- arguments=$( printf "%q " "$@" )
+ arguments=$( env printf '%q ' "$@" )
su -c "$arguments"
fi
}