AK2: simplify new contains(), adjust placement, and update documentation

This commit is contained in:
osm0sis committed 2016-03-16 14:08:50 -03:00
1 parent a5bb583af5
commit ea57ded2c2
2 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ Similarly, "line match string" and "line replace string" are the search strings
"block|mount|fstype|options|flags" requires you specify which part (listed in order) of the fstab entry you want to check and alter.
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, and contains "<string>" "<substring>" to simplify string testing logic you might want in your script.
Note: the "begin search string" and "end search string" arguments of replace_section and remove_section require any forward slashes (/) to be escaped.
+5 -5
View File
@@ -31,8 +31,13 @@ chmod -R 755 $bin;
mkdir -p $ramdisk $split_img;
OUTFD=/proc/self/fd/$1;
# ui_print <text>
ui_print() { echo -e "ui_print $1\nui_print" > $OUTFD; }
# contains <string> <substring>
contains() { test "${1#*$2}" != "$1" && return 0 || return 1; }
# dump boot and extract ramdisk
dump_boot() {
dd if=$block of=/tmp/anykernel/boot.img;
@@ -50,11 +55,6 @@ dump_boot() {
cp -af /tmp/anykernel/rdtmp/* $ramdisk;
}
# contains <string> <substring>
contains() {
if test "${1#*$2}" != "$1"; then return 0; else return 1; fi;
}
# repack ramdisk then build and write image
write_boot() {
cd $split_img;