AK2: fix patch_fstab substring replacement

- the 'original string' ($5) was not being used, instead the entire part was always being replaced with the 'replacement string' ($6)
- replace the target 'original string' of the entry part with 'replacement string' as expected/intended

NOTE: any properly written patch_fstab commands with original string as the complete original part WILL remain working as this is a backwards compatible change
This commit is contained in:
osm0sis committed 2017-09-22 01:35:51 -03:00
1 parent 65019b0f49
commit aa1377c9ab
1 file changed
+2 -1
+2 -1
View File
@@ -364,7 +364,8 @@ patch_fstab() {
options) part=$(echo "$entry" | awk '{ print $4 }');; options) part=$(echo "$entry" | awk '{ print $4 }');;
flags) part=$(echo "$entry" | awk '{ print $5 }');; flags) part=$(echo "$entry" | awk '{ print $5 }');;
esac; esac;
newentry=$(echo "$entry" | sed "s;${part};${6};"); newpart=$(echo "$part" | sed "s;${5};${6};");
newentry=$(echo "$entry" | sed "s;${part};${newpart};");
sed -i "s;${entry};${newentry};" $1; sed -i "s;${entry};${newentry};" $1;
fi; fi;
} }