From cf764ee768a0f3ad2f8a41d90aa4e656d31d5f7a Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Sun, 15 Oct 2017 15:32:15 -0700 Subject: [PATCH] AK2: Improve patch_fstab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After aa1377c, trying to remove part of the original string was not possible. Example: patch_fstab fstab.qcom /system ext4 flags “wait,verify” “wait” Because "wait" is within "wait,verify", the entire if block will miss since grep will succeed in finding it. To work around this, we'll allow users to leave the last part blank and put in the part they want to remove as the fifth parameter. Example: patch_fstab fstab.qcom /system ext4 flags “,verify” “” Signed-off-by: Nathan Chancellor --- tools/ak2-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh index c89b488..b7a8a7d 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -357,7 +357,7 @@ replace_file() { # patch_fstab patch_fstab() { entry=$(grep "$2" $1 | grep "$3"); - if [ -z "$(echo "$entry" | grep "$6")" ]; then + if [ -z "$(echo "$entry" | grep "$6")" ] || [ -z $6 ]; then case $4 in block) part=$(echo "$entry" | awk '{ print $1 }');; mount) part=$(echo "$entry" | awk '{ print $2 }');;