aboutsummaryrefslogtreecommitdiff
path: root/libs/common
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2017-10-26 02:32:54 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2017-10-28 23:30:01 -0400
commit85934d62d767a484fa560066b6edb69a18145690 (patch)
tree8136b2cdfe3bee1b8ed854d519811e953ca0e4a7 /libs/common
parentc3f80f40f9e9b7bc3a57c3ed774dfdc1f46a8196 (diff)
downloadlibrebootfr-85934d62d767a484fa560066b6edb69a18145690.tar.gz
librebootfr-85934d62d767a484fa560066b6edb69a18145690.zip
Replace usage of the '[' Bash builtin with '[['
There's no benefit to using the POSIX-style '[' test builtin considering its '-a' and '-o' operators are unused in the Libreboot build system. Plus, '[[' is safer with respect to any containing file redirections (for example). Prior, both '[' and '[[' were used throughout the codebase--a disparity in usage which this change aims to eliminate.
Diffstat (limited to 'libs/common')
-rwxr-xr-xlibs/common16
1 files changed, 8 insertions, 8 deletions
diff --git a/libs/common b/libs/common
index 750886db..b7a7022e 100755
--- a/libs/common
+++ b/libs/common
@@ -155,7 +155,7 @@ file_checksum_check() {
local name=$( basename "$path" )
local directory_path=$( dirname "$path" )
- if ! [ -f "$checksum_path" ]
+ if ! [[ -f "$checksum_path" ]]
then
printf 1>&2 '%s\n' 'Could not verify file checksum!'
return 1
@@ -172,7 +172,7 @@ file_signature_create() {
local signature_path="$path.$DSIG"
- if [ -z "$RELEASE_KEY" ]
+ if [[ -z "$RELEASE_KEY" ]]
then
return 0
fi
@@ -185,7 +185,7 @@ file_signature_check() {
local signature_path="$path.$DSIG"
- if ! [ -f "$signature_path" ]
+ if ! [[ -f "$signature_path" ]]
then
printf 1>&2 '%s\n' 'Could not verify file signature!'
return 1
@@ -217,7 +217,7 @@ file_exists_check() {
directory_filled_check() {
local path=$1
- if [ -z "$( ls -A "$path" 2> /dev/null )" ]
+ if [[ -z "$( ls -A "$path" 2> /dev/null )" ]]
then
return 1
else
@@ -381,7 +381,7 @@ requirements() {
do
requirement_path=$( which "$requirement" || true )
- if [ -z "$requirement_path" ]
+ if [[ -z "$requirement_path" ]]
then
printf 1>&2 '%s\n' "Missing requirement: $requirement"
exit 1
@@ -398,7 +398,7 @@ requirements_root() {
# We need to keep stdout output to show the command.
requirement_path=$( execute_root which "$requirement" || true )
- if [ -z "$requirement_path" ]
+ if [[ -z "$requirement_path" ]]
then
printf 1>&2 '%s\n' "Missing requirement: $requirement"
exit 1
@@ -414,7 +414,7 @@ arguments_concat() {
for argument in "$@"
do
- if ! [ -z "$concat" ]
+ if ! [[ -z "$concat" ]]
then
concat="$concat""$delimiter""$argument"
else
@@ -432,7 +432,7 @@ execute_root() {
printf 1>&2 '%s' 'Running command as root: '
printf 1>&2 '%b\n' "$*"
- if ! [ -z "$sudo" ]
+ if ! [[ -z "$sudo" ]]
then
sudo "$@"
else