OSDN Git Service

mkuserimg_mke2fs: fix empty -E to mke2fs and empty -S to e2fsdroid
authorBen Fennema <fennema@google.com>
Wed, 8 Mar 2017 22:21:00 +0000 (14:21 -0800)
committerBen Fennema <fennema@google.com>
Wed, 8 Mar 2017 22:54:26 +0000 (14:54 -0800)
not passing in -s caused a -E to be passed to mke2fs without any options
not passing in FILE_CONTEXTS caused a -S to be passed to e2fsdroid
without a file

Test: build oem image (doesn't pass in -s or [FILE_CONTEXTS])
Change-Id: Id00ca79b6b5fdc75e603ab568d74f1a183f8e56b
Signed-off-by: Ben Fennema <fennema@google.com>
ext4_utils/mkuserimg_mke2fs.sh

index e6fca45..7d5d2e3 100755 (executable)
@@ -95,7 +95,7 @@ if [[ "$1" == "-i" ]]; then
 fi
 
 if [[ "$1" == "-e" ]]; then
-  if [[ MKE2FS_EXTENDED_OPTS ]]; then
+  if [[ $MKE2FS_EXTENDED_OPTS ]]; then
     MKE2FS_EXTENDED_OPTS+=","
   fi
   MKE2FS_EXTENDED_OPTS+="stripe_width=$(($2/BLOCKSIZE))"
@@ -103,7 +103,7 @@ if [[ "$1" == "-e" ]]; then
 fi
 
 if [[ "$1" == "-o" ]]; then
-  if [[ MKE2FS_EXTENDED_OPTS ]]; then
+  if [[ $MKE2FS_EXTENDED_OPTS ]]; then
     MKE2FS_EXTENDED_OPTS+=","
   fi
   # stride should be the max of 8kb and the logical block size
@@ -111,11 +111,13 @@ if [[ "$1" == "-o" ]]; then
   shift; shift
 fi
 
-if [[ MKE2FS_EXTENDED_OPTS ]]; then
+if [[ $MKE2FS_EXTENDED_OPTS ]]; then
   MKE2FS_OPTS+=" -E $MKE2FS_EXTENDED_OPTS"
 fi
 
-E2FSDROID_OPTS+=" -S $1"
+if [[ $1 ]]; then
+  E2FSDROID_OPTS+=" -S $1"
+fi
 
 case $EXT_VARIANT in
   ext4) ;;