diff options
author | Nathan Chancellor <natechancellor@gmail.com> | 2017-10-15 15:32:15 -0700 |
---|---|---|
committer | Chris Renshaw <osm0sis@outlook.com> | 2017-10-15 22:27:34 -0300 |
commit | cf764ee768a0f3ad2f8a41d90aa4e656d31d5f7a (patch) | |
tree | 1685be8cc446362365c94d8c28d826258c30bfb8 /tools | |
parent | 6bcf2668e48944eba503192e348ff7830592c0a0 (diff) |
AK2: Improve patch_fstab
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 <natechancellor@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ak2-core.sh | 2 |
1 files changed, 1 insertions, 1 deletions
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 <fstab file> <mount match name> <fs match type> <block|mount|fstype|options|flags> <original string> <replacement string> 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 }');; |