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