AK2: add remove_section, update documentation with note regarding escapes
This commit is contained in:
1 parent
8c64041208
commit
65520217ef
2 files changed
+8
No files matched your search
@@ -33,6 +33,7 @@ dump_boot
|
|||||||
backup_file <file>
|
backup_file <file>
|
||||||
replace_string <file> <if search string> <original string> <replacement string>
|
replace_string <file> <if search string> <original string> <replacement string>
|
||||||
replace_section <file> <begin search string> <end search string> <replacement string>
|
replace_section <file> <begin search string> <end search string> <replacement string>
|
||||||
|
remove_section <file> <begin search string> <end search string>
|
||||||
insert_line <file> <if search string> <before|after> <line match string> <inserted line>
|
insert_line <file> <if search string> <before|after> <line match string> <inserted line>
|
||||||
replace_line <file> <line replace string> <replacement line>
|
replace_line <file> <line replace string> <replacement line>
|
||||||
remove_line <file> <line match string>
|
remove_line <file> <line match string>
|
||||||
@@ -53,6 +54,8 @@ Similarly, "line match string" and "line replace string" are the search strings
|
|||||||
|
|
||||||
You may also use ui_print "<text>" to write messages back to the recovery during the modification process.
|
You may also use ui_print "<text>" to write messages back to the recovery during the modification process.
|
||||||
|
|
||||||
|
Note: the "begin search string" and "end search string" arguments of replace_section and remove_section require any forward slashes (/) to be escaped.
|
||||||
|
|
||||||
// Instructions
|
// Instructions
|
||||||
|
|
||||||
1- Place zImage in the root (dtb should also go here for devices that require a custom one, both will fallback to the original if not included)
|
1- Place zImage in the root (dtb should also go here for devices that require a custom one, both will fallback to the original if not included)
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ replace_section() {
|
|||||||
sed -i "${line}s;^;${4}\n;" $1;
|
sed -i "${line}s;^;${4}\n;" $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# remove_section <file> <begin search string> <end search string>
|
||||||
|
remove_section() {
|
||||||
|
sed -i "/${2}/,/${3}/d" $1;
|
||||||
|
}
|
||||||
|
|
||||||
# insert_line <file> <if search string> <before|after> <line match string> <inserted line>
|
# insert_line <file> <if search string> <before|after> <line match string> <inserted line>
|
||||||
insert_line() {
|
insert_line() {
|
||||||
if [ -z "$(grep "$2" $1)" ]; then
|
if [ -z "$(grep "$2" $1)" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user