From ea57ded2c2e9075d0496f4e4531e1a33623463ea Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 16 Mar 2016 14:08:50 -0300 Subject: [PATCH] AK2: simplify new contains(), adjust placement, and update documentation --- README | 2 +- anykernel.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index 31ccaa6..b88fa14 100644 --- a/README +++ b/README @@ -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 "" to write messages back to the recovery during the modification process. +You may also use ui_print "" to write messages back to the recovery during the modification process, and contains "" "" 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. diff --git a/anykernel.sh b/anykernel.sh index 86d9ff9..cb63d95 100755 --- a/anykernel.sh +++ b/anykernel.sh @@ -31,8 +31,13 @@ chmod -R 755 $bin; mkdir -p $ramdisk $split_img; OUTFD=/proc/self/fd/$1; + +# ui_print ui_print() { echo -e "ui_print $1\nui_print" > $OUTFD; } +# contains +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 -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;