diff options
author | Nathan Chancellor <natechancellor@gmail.com> | 2017-10-15 16:50:23 -0700 |
---|---|---|
committer | Chris Renshaw <osm0sis@outlook.com> | 2017-10-15 22:27:34 -0300 |
commit | d907653c7864fc0581f9297f719709cfee62e4d8 (patch) | |
tree | 8297a57078c340634e3e95616ef6049155bc0764 | |
parent | cf764ee768a0f3ad2f8a41d90aa4e656d31d5f7a (diff) |
AK2: Sanitize patch_fstab for proper commas
Users may forget to place the commas for removal or they may want to
remove something in the middle. This will remove all commas at the
beginning and end and will make sure there are only single commas
between entries.
Examples:
Options: ro,barrier=1,discard,errors=panic
patch_fstab fstab.qcom /system ext4 options "discard,errors=panic" ""
patch_fstab fstab.qcom /system ext4 options ",errors=panic" ""
patch_fstab fstab.qcom /system ext4 options "errors=panic" ""
patch_fstab fstab.qcom /system ext4 options "discard" ""
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
-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 b7a8a7d..b18353a 100755 --- a/tools/ak2-core.sh +++ b/tools/ak2-core.sh @@ -365,7 +365,7 @@ patch_fstab() { options) part=$(echo "$entry" | awk '{ print $4 }');; flags) part=$(echo "$entry" | awk '{ print $5 }');; esac; - newpart=$(echo "$part" | sed "s;${5};${6};"); + newpart=$(echo "$part" | sed -e "s;${5};${6};" -e 's;,\{2,\};,;g' -e 's;,*$;;g' -e 's;^,;;g'); newentry=$(echo "$entry" | sed "s;${part};${newpart};"); sed -i "s;${entry};${newentry};" $1; fi; |