[v2] "bitbake-prserv-tool: Added quotes to variables to prevent splitting and gobbling"

Message ID 20220413100746.6383-1-abongwabonalais@gmail.com
State New
Headers show
Series [v2] "bitbake-prserv-tool: Added quotes to variables to prevent splitting and gobbling" | expand

Commit Message

Abongwa Bonalais April 13, 2022, 10:07 a.m. UTC
Signed-off-by: Abongwa Bonalais Amahnui <abongwabonalais@gmail.com>
---
 scripts/bitbake-prserv-tool | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

Patch

diff --git a/scripts/bitbake-prserv-tool b/scripts/bitbake-prserv-tool
index e55d98c72e..c9fe4afca9 100755
--- a/scripts/bitbake-prserv-tool
+++ b/scripts/bitbake-prserv-tool
@@ -5,7 +5,7 @@ 
 
 help ()
 {
-    base=`basename $0`
+    base=`basename "$0"`
     echo -e "Usage: $base command"
     echo "Avaliable commands:"
     echo -e "\texport <file.conf>: export and lock down the AUTOPR values from the PR service into a file for release."
@@ -16,22 +16,22 @@  clean_cache()
 {
     s=`bitbake -e | grep ^CACHE= | cut -f2 -d\"`
     if [ "x${s}" != "x" ]; then
-        rm -rf ${s}
+        rm -rf "${s}"
     fi
 }
 
 do_export ()
 {
-    file=$1
+    file="$1"
     [ "x${file}" == "x" ] && help && exit 1
-    rm -f ${file}
+    rm -f "${file}"
 
     clean_cache
     bitbake -R conf/prexport.conf -p
     s=`bitbake -R conf/prexport.conf -e | grep ^PRSERV_DUMPFILE= | cut -f2 -d\"`
     if [ "x${s}" != "x" ];
     then
-       [ -e $s ] && mv -f $s $file && echo "Exporting to file $file succeeded!"
+       [ -e "$s" ] && mv -f "$s" "$file" && echo "Exporting to file $file succeeded!"
        return 0
     fi
     echo "Exporting to file $file failed!"
@@ -40,11 +40,11 @@  do_export ()
 
 do_import ()
 {
-    file=$1
+    file="$1"
     [ "x${file}" == "x" ] && help && exit 1
 
     clean_cache
-    bitbake -R conf/primport.conf -R $file -p
+    bitbake -R conf/primport.conf -R "$file" -p
     ret=$?
     [ $ret -eq 0 ] && echo "Importing from file $file succeeded!" || echo "Importing from file $file failed!"
     return $ret
@@ -60,13 +60,13 @@  do_migrate_localcount ()
         return 1
     fi
 
-    rm -rf $df
+    rm -rf "$df"
     clean_cache
     echo "Exporting LOCALCOUNT to AUTOINCs..."
     bitbake -R conf/migrate_localcount.conf -p
     [ ! $? -eq 0 ] && echo "Exporting to file $df failed!" && exit 1
 
-    if [ -e $df ];
+    if [ -e "$df" ];
     then
         echo "Exporting to file $df succeeded!"
     else
@@ -75,7 +75,7 @@  do_migrate_localcount ()
     fi
     
     echo "Importing generated AUTOINC entries..."
-    [ -e $df ] && do_import $df
+    [ -e "$df" ] && do_import "$df"
 
     if [ ! $? -eq 0 ]
     then
@@ -93,17 +93,17 @@  case $2 in
 *.conf|*.inc)
     ;;
 *)
-    echo ERROR: $2 must end with .conf or .inc!
+    echo ERROR: "$2" must end with .conf or .inc!
     exit 1
     ;;
 esac
 
 case $1 in
 export)
-    do_export $2
+    do_export "$2"
     ;;
 import)
-    do_import $2
+    do_import "$2"
     ;;
 migrate_localcount)
     do_migrate_localcount