AK3: Fix patch_fstab function (#66)

Patching system partition entry won't work if system_ext partition is present. Fix this by adding [[:space:]] to the end of the pattern.
Note that grep -w can't be used in this case because there is still a possibility of erroneous matches from grep using / as a whole word delimiter, e.g., logical vendor partition (that is just "vendor") and "/vendor/dsp".
This commit is contained in:
Alexander Winkowski authored and GitHub committed 2022-03-04 03:59:38 -04:00
1 parent 446ad5d85d
commit 076e748dc3
1 file changed
+1 -1
+1 -1
View File
@@ -615,7 +615,7 @@ replace_file() {
# patch_fstab <fstab file> <mount match name> <fs match type> block|mount|fstype|options|flags <original string> <replacement string>
patch_fstab() {
local entry part newpart newentry;
entry=$(grep "$2" $1 | grep "$3");
entry=$(grep "$2[[:space:]]" $1 | grep "$3");
if [ ! "$(echo "$entry" | grep "$6")" -o "$6" == " " -o ! "$6" ]; then
case $4 in
block) part=$(echo "$entry" | awk '{ print $1 }');;