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>
This commit is contained in:
1 parent
6bcf2668e4
commit
cf764ee768
1 file changed
+1
-1
+1
-1
@@ -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 }');;
|
||||
|
||||
Reference in new issue
Block a user