summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMETA-INF/com/google/android/update-binary604
-rwxr-xr-xanykernel.sh2
-rwxr-xr-xtools/ak3-core.sh117
3 files changed, 434 insertions, 289 deletions
diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary
index 5704f16..d2293f0 100755
--- a/META-INF/com/google/android/update-binary
+++ b/META-INF/com/google/android/update-binary
@@ -5,131 +5,243 @@
OUTFD=/proc/self/fd/$2;
ZIPFILE="$3";
-ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false;
+BOOTMODE=false;
+ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true;
$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true;
-$BOOTMODE && DIR=/sdcard || DIR=$(dirname "$ZIPFILE");
+DIR=/sdcard;
+$BOOTMODE || DIR=$(dirname "$ZIPFILE");
-test "$ANDROID_ROOT" || ANDROID_ROOT=/system;
-test "$home" || home=/tmp/anykernel;
+[ -d /postinstall/tmp ] && POSTINSTALL=/postinstall;
+[ "$AKHOME" ] || AKHOME=$POSTINSTALL/tmp/anykernel;
+[ "$ANDROID_ROOT" ] || ANDROID_ROOT=/system;
ui_print() {
until [ ! "$1" ]; do
- echo -e "ui_print $1\nui_print" > $OUTFD;
+ echo "ui_print $1
+ ui_print" >> $OUTFD;
shift;
done;
}
ui_printfile() {
- while IFS='' read -r line || $bb [[ -n "$line" ]]; do
+ while IFS='' read -r line || $BB [[ -n "$line" ]]; do
ui_print "$line";
done < $1;
}
-show_progress() { echo "progress $1 $2" > $OUTFD; }
-file_getprop() { $bb grep "^$2=" "$1" | $bb cut -d= -f2-; }
-int2ver() {
- if [ "$1" -eq "$1" ] 2>/dev/null; then
- echo "$1.0.0";
- elif [ ! "$(echo "$1" | $bb cut -d. -f3)" ]; then
- echo "$1.0";
- else
- echo "$1";
+show_progress() { echo "progress $1 $2" >> $OUTFD; }
+file_getprop() { $BB grep "^$2=" "$1" | $BB cut -d= -f2-; }
+find_slot() {
+ local slot=$(getprop ro.boot.slot_suffix 2>/dev/null);
+ [ "$slot" ] || slot=$($BB grep -o 'androidboot.slot_suffix=.*$' /proc/cmdline | $BB cut -d\ -f1 | $BB cut -d= -f2);
+ if [ ! "$slot" ]; then
+ slot=$(getprop ro.boot.slot 2>/dev/null);
+ [ "$slot" ] || slot=$($BB grep -o 'androidboot.slot=.*$' /proc/cmdline | $BB cut -d\ -f1 | $BB cut -d= -f2);
+ [ "$slot" ] && slot=_$slot;
fi;
-}
-cleanup() {
- cd $(dirname $home);
- rm -rf $home;
-}
-debugging() {
- case $(basename "$ZIPFILE" .zip) in
- *-debugging)
- ui_print " " "Creating debugging archive in $DIR...";
- test -f /tmp/recovery.log && log=/tmp/recovery.log;
- $bb tar -czf "$DIR/anykernel3-$(date +%Y-%m-%d_%H%M%S)-debug.tgz" $home $log;
- ;;
- esac;
+ [ "$slot" ] && echo "$slot";
}
setup_mountpoint() {
- test -L $1 && $bb mv -f $1 ${1}_link;
+ [ -L $1 ] && $BB mv -f $1 ${1}_link;
if [ ! -d $1 ]; then
rm -f $1;
- mkdir $1;
- fi;
-}
-is_mounted() { $bb mount | $bb grep -q " $1 "; }
-umount_all() {
- (if ! $BOOTMODE; then
- umount_apex;
- $bb umount /system;
- $bb umount -l /system;
- if [ -e /system_root ]; then
- $bb umount /system_root;
- $bb umount -l /system_root;
- fi;
+ mkdir -p $1;
fi;
- umount /vendor;
- umount -l /vendor;
- if [ "$umount_data" ]; then
- $bb umount /data;
- $bb umount -l /data;
- fi) 2>/dev/null;
}
+is_mounted() { $BB mount | $BB grep -q " $1 "; }
mount_apex() {
- test -d /system/apex || return 1;
+ [ -d /system_root/system/apex ] || return 1;
local apex dest loop minorx num;
setup_mountpoint /apex;
- test -e /dev/block/loop1 && minorx=$(ls -l /dev/block/loop1 | $bb awk '{ print $6 }') || minorx=1;
+ minorx=1;
+ [ -e /dev/block/loop1 ] && minorx=$($BB ls -l /dev/block/loop1 | $BB awk '{ print $6 }');
num=0;
- for apex in /system/apex/*; do
- dest=/apex/$(basename $apex .apex);
- test "$dest" == /apex/com.android.runtime.release && dest=/apex/com.android.runtime;
- mkdir -p $dest;
+ for apex in /system_root/system/apex/*; do
+ dest=/apex/$($BB basename $apex .apex);
+ [ "$dest" == /apex/com.android.runtime.release ] && dest=/apex/com.android.runtime;
+ $BB mkdir -p $dest;
case $apex in
*.apex)
- $bb unzip -qo $apex apex_payload.img -d /apex;
- $bb mv -f /apex/apex_payload.img $dest.img;
- $bb mount -t ext4 -o ro,noatime $dest.img $dest 2>/dev/null;
+ $BB unzip -qo $apex apex_payload.img -d /apex;
+ $BB mv -f /apex/apex_payload.img $dest.img;
+ $BB mount -t ext4 -o ro,noatime $dest.img $dest 2>/dev/null;
if [ $? != 0 ]; then
while [ $num -lt 64 ]; do
loop=/dev/block/loop$num;
- ($bb mknod $loop b 7 $((num * minorx));
- $bb losetup $loop $dest.img) 2>/dev/null;
+ ($BB mknod $loop b 7 $((num * minorx));
+ $BB losetup $loop $dest.img) 2>/dev/null;
num=$((num + 1));
- $bb losetup $loop | $bb grep -q $dest.img && break;
+ $BB losetup $loop | $BB grep -q $dest.img && break;
done;
- $bb mount -t ext4 -o ro,loop,noatime $loop $dest;
+ $BB mount -t ext4 -o ro,loop,noatime $loop $dest;
if [ $? != 0 ]; then
- $bb losetup -d $loop 2>/dev/null;
+ $BB losetup -d $loop 2>/dev/null;
fi;
fi;
;;
- *) $bb mount -o bind $apex $dest;;
+ *) $BB mount -o bind $apex $dest;;
esac;
done;
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime;
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata;
- export BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar;
+ export BOOTCLASSPATH=/apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.test.base.jar:/system/framework/telephony-ext.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar;
}
umount_apex() {
- test -d /apex || return 1;
+ [ -d /apex ] || return 1;
local dest loop;
- for dest in $($bb find /apex -type d -mindepth 1 -maxdepth 1); do
+ for dest in $($BB find /apex -type d -mindepth 1 -maxdepth 1); do
if [ -f $dest.img ]; then
- loop=$($bb mount | $bb grep $dest | $bb cut -d" " -f1);
+ loop=$($BB mount | $BB grep $dest | $BB cut -d\ -f1);
fi;
- ($bb umount -l $dest;
- $bb losetup -d $loop) 2>/dev/null;
+ ($BB umount -l $dest;
+ $BB losetup -d $loop) 2>/dev/null;
done;
- rm -rf /apex;
+ $BB rm -rf /apex 2>/dev/null;
unset ANDROID_RUNTIME_ROOT ANDROID_TZDATA_ROOT BOOTCLASSPATH;
}
+mount_all() {
+ if ! is_mounted /cache; then
+ $BB mount /cache 2>/dev/null && UMOUNT_CACHE=1;
+ fi;
+ if ! is_mounted /data; then
+ $BB mount /data && UMOUNT_DATA=1;
+ fi;
+ ($BB mount -o ro -t auto /vendor;
+ $BB mount -o ro -t auto /product;
+ $BB mount -o ro -t auto /persist) 2>/dev/null;
+ setup_mountpoint $ANDROID_ROOT;
+ if ! is_mounted $ANDROID_ROOT; then
+ $BB mount -o ro -t auto $ANDROID_ROOT 2>/dev/null;
+ fi;
+ case $ANDROID_ROOT in
+ /system_root) setup_mountpoint /system;;
+ /system)
+ if ! is_mounted /system && ! is_mounted /system_root; then
+ setup_mountpoint /system_root;
+ $BB mount -o ro -t auto /system_root;
+ elif [ -f /system/system/build.prop ]; then
+ setup_mountpoint /system_root;
+ $BB mount --move /system /system_root;
+ fi;
+ if [ $? != 0 ]; then
+ ($BB umount /system;
+ $BB umount -l /system) 2>/dev/null;
+ if [ -d /dev/block/mapper ]; then
+ [ -e /dev/block/mapper/system ] || local slot=$(find_slot);
+ $BB mount -o ro -t auto /dev/block/mapper/vendor$slot /vendor;
+ $BB mount -o ro -t auto /dev/block/mapper/product$slot /product 2>/dev/null;
+ $BB mount -o ro -t auto /dev/block/mapper/system$slot /system_root;
+ else
+ [ -e /dev/block/bootdevice/by-name/system ] || local slot=$(find_slot);
+ ($BB mount -o ro -t auto /dev/block/bootdevice/by-name/vendor$slot /vendor;
+ $BB mount -o ro -t auto /dev/block/bootdevice/by-name/product$slot /product;
+ $BB mount -o ro -t auto /dev/block/bootdevice/by-name/persist$slot /persist) 2>/dev/null;
+ $BB mount -o ro -t auto /dev/block/bootdevice/by-name/system$slot /system_root;
+ fi;
+ fi;
+ ;;
+ esac;
+ if is_mounted /system_root; then
+ mount_apex;
+ if [ -f /system_root/build.prop ]; then
+ $BB mount -o bind /system_root /system;
+ else
+ $BB mount -o bind /system_root/system /system;
+ fi;
+ fi;
+}
+umount_all() {
+ local mount;
+ (if [ ! -d /postinstall/tmp ]; then
+ $BB umount /system;
+ $BB umount -l /system;
+ if [ -e /system_root ]; then
+ $BB umount /system_root;
+ $BB umount -l /system_root;
+ fi;
+ fi;
+ umount_apex;
+ umount /vendor; # busybox umount /vendor breaks recovery on some devices
+ umount -l /vendor;
+ for mount in /mnt/system /mnt/vendor /product /mnt/product /persist; do
+ $BB umount $mount;
+ $BB umount -l $mount;
+ done;
+ if [ "$UMOUNT_DATA" ]; then
+ $BB umount /data;
+ $BB umount -l /data;
+ fi;
+ if [ "$UMOUNT_CACHE" ]; then
+ $BB umount /cache;
+ $BB umount -l /cache;
+ fi) 2>/dev/null;
+}
+setup_env() {
+ $BOOTMODE && return 1;
+ $BB mount -o bind /dev/urandom /dev/random;
+ if [ -L /etc ]; then
+ setup_mountpoint /etc;
+ $BB cp -af /etc_link/* /etc;
+ $BB sed -i 's; / ; /system_root ;' /etc/fstab;
+ fi;
+ umount_all;
+ mount_all;
+ OLD_LD_PATH=$LD_LIBRARY_PATH;
+ OLD_LD_PRE=$LD_PRELOAD;
+ OLD_LD_CFG=$LD_CONFIG_FILE;
+ unset LD_LIBRARY_PATH LD_PRELOAD LD_CONFIG_FILE;
+ if [ ! "$(getprop 2>/dev/null)" ]; then
+ getprop() {
+ local propdir propfile propval;
+ for propdir in / /system_root /system /vendor /odm /product; do
+ for propfile in default.prop build.prop; do
+ if [ "$propval" ]; then
+ break 2;
+ else
+ propval="$(file_getprop $propdir/$propfile $1 2>/dev/null)";
+ fi;
+ done;
+ done;
+ if [ "$propval" ]; then
+ echo "$propval";
+ else
+ echo "";
+ fi;
+ }
+ elif [ ! "$(getprop ro.build.type 2>/dev/null)" ]; then
+ getprop() {
+ ($(which getprop) | $BB grep "$1" | $BB cut -d[ -f3 | $BB cut -d] -f1) 2>/dev/null;
+ }
+ fi;
+}
restore_env() {
- test "$savedpath" && export LD_LIBRARY_PATH="$savedpath";
- test "$savedpre" && export LD_PRELOAD="$savedpre";
+ $BOOTMODE && return 1;
+ local dir;
+ unset -f getprop;
+ [ "$OLD_LD_PATH" ] && export LD_LIBRARY_PATH=$OLD_LD_PATH;
+ [ "$OLD_LD_PRE" ] && export LD_PRELOAD=$OLD_LD_PRE;
+ [ "$OLD_LD_CFG" ] && export LD_CONFIG_FILE=$OLD_LD_CFG;
umount_all;
- ($bb mv -f /apex_link /apex;
- $bb mv -f /system_link /system;
- $bb mv -f /system_root_link /system_root;
- $bb umount -l /dev/random) 2>/dev/null;
+ [ -L /etc_link ] && $BB rm -rf /etc/*;
+ (for dir in /apex /system /system_root /etc; do
+ if [ -L "${dir}_link" ]; then
+ rmdir $dir;
+ $BB mv -f ${dir}_link $dir;
+ fi;
+ done;
+ $BB umount -l /dev/random) 2>/dev/null;
+}
+debugging() {
+ case $(basename "$ZIPFILE" .zip) in
+ *-debugging)
+ ui_print " " "Creating debugging archive in $DIR...";
+ [ -f /tmp/recovery.log ] && local log=/tmp/recovery.log;
+ $BB tar -czf "$DIR/anykernel3-$(date +%Y-%m-%d_%H%M%S)-debug.tgz" $AKHOME $log;
+ ;;
+ esac;
+}
+cleanup() {
+ cd $(dirname $AKHOME);
+ rm -rf $AKHOME;
}
abort() {
ui_print "$@";
@@ -140,102 +252,10 @@ abort() {
fi;
exit 1;
}
-
-show_progress 1.34 4;
-ui_print " ";
-cleanup;
-mkdir -p $home/bin;
-cd $home;
-unzip -o "$ZIPFILE";
-if [ $? != 0 -o ! "$(ls tools)" ]; then
- abort "Unzip failed. Aborting...";
-fi;
-for arch32 in x86 arm; do
- if [ -d $home/tools/$arch32 ]; then
- bb=$home/tools/$arch32/busybox;
- chmod 755 $bb;
- $bb >/dev/null 2>&1;
- if [ $? == 0 ]; then
- $bb mv -f $home/tools/$arch32/* $home/tools;
- break;
- fi;
- fi;
-done;
-bb=$home/tools/busybox;
-chmod 755 $bb;
-$bb chmod -R 755 tools bin;
-$bb --install -s bin;
-if [ $? != 0 -o -z "$(ls bin)" ]; then
- abort "Busybox setup failed. Aborting...";
-fi;
-
-ui_print " ";
-ui_print "================================= ";
-ui_print " ";
-ui_print " - $(file_getprop /tmp/anykernel/anykernel.sh kernel.string)";
-ui_print " ";
-ui_print "================================= ";
-ui_print " ";
-if [ -f version ]; then
- ui_print " ";
- ui_printfile version;
- ui_print " ";
-fi;
-ui_print " - AnyKernel3 by osm0sis ";
-
-$BOOTMODE || $bb mount -o bind /dev/urandom /dev/random;
-umount_all;
-setup_mountpoint $ANDROID_ROOT;
-if ! is_mounted $ANDROID_ROOT; then
- $bb mount -o ro -t auto $ANDROID_ROOT;
-fi;
-case $ANDROID_ROOT in
- /system_root) setup_mountpoint /system;;
- /system)
- if [ -f /system/system/build.prop ]; then
- setup_mountpoint /system_root;
- $bb mount --move /system /system_root;
- if [ $? != 0 ]; then
- $bb umount /system;
- $bb umount -l /system 2>/dev/null;
- $bb mount -o ro -t auto /dev/block/bootdevice/by-name/system /system_root;
- fi;
- fi;
- ;;
-esac;
-if is_mounted /system_root; then
- $bb mount -o bind /system_root/system /system;
-fi;
-$bb mount -o ro -t auto /vendor 2>/dev/null;
-$BOOTMODE || mount_apex;
-if ! is_mounted /data; then
- $bb mount /data;
- umount_data=1;
-fi;
-
-savedpath="$LD_LIBRARY_PATH";
-savedpre="$LD_PRELOAD";
-unset LD_LIBRARY_PATH;
-unset LD_PRELOAD;
-
-if [ ! "$(getprop 2>/dev/null)" ]; then
- getprop() {
- local propdir propfile propval;
- for propdir in / /system_root /system /vendor /odm /product; do
- for propfile in default.prop build.prop; do
- test "$propval" && break 2 || propval="$(file_getprop $propdir/$propfile $1 2>/dev/null)";
- done;
- done;
- test "$propval" && echo "$propval" || echo "";
- }
-elif [ ! "$(getprop ro.build.type 2>/dev/null)" ]; then
- getprop() {
- ($(which getprop) | $bb grep "$1" | $bb cut -d[ -f3 | $bb cut -d] -f1) 2>/dev/null;
- }
-fi;
-
-if [ "$(file_getprop anykernel.sh do.devicecheck)" == 1 ]; then
- ui_print " - Checking device...";
+do_devicecheck() {
+ [ "$(file_getprop anykernel.sh do.devicecheck)" == 1 ] || return 1;
+ local device devicename match product testname vendordevice vendorproduct;
+ ui_print "Checking device...";
device=$(getprop ro.product.device 2>/dev/null);
product=$(getprop ro.build.product 2>/dev/null);
vendordevice=$(getprop ro.product.vendor.device 2>/dev/null);
@@ -243,30 +263,40 @@ if [ "$(file_getprop anykernel.sh do.devicecheck)" == 1 ]; then
for testname in $(file_getprop anykernel.sh 'device.name.*'); do
for devicename in $device $product $vendordevice $vendorproduct; do
if [ "$devicename" == "$testname" ]; then
- ui_print " - Device: $testname";
+ ui_print "$testname" " ";
match=1;
break 2;
fi;
done;
done;
if [ ! "$match" ]; then
- abort " - Unsupported device. Aborting...";
+ abort " " "Unsupported device. Aborting...";
fi;
-fi;
-
-supported_ver=$(file_getprop anykernel.sh supported.versions | $bb tr -d '[:space:]');
-if [ "$supported_ver" ]; then
- ui_print " - Checking Android version...";
+}
+int2ver() {
+ if $BB [ "$1" -eq "$1" ] 2>/dev/null; then
+ echo "$1.0.0";
+ elif [ ! "$(echo "$1" | $BB cut -d. -f3)" ]; then
+ echo "$1.0";
+ else
+ echo "$1";
+ fi;
+}
+do_versioncheck() {
+ [ "$(file_getprop anykernel.sh supported.versions)" ] || return 1;
+ local android_ver hi_ver lo_ver parsed_ver supported supported_ver;
+ ui_print "Checking Android version...";
+ supported_ver=$(file_getprop anykernel.sh supported.versions | $BB tr -d '[:space:]');
android_ver=$(file_getprop /system/build.prop ro.build.version.release);
parsed_ver=$(int2ver $android_ver);
- if echo $supported_ver | $bb grep -q '-'; then
- lo_ver=$(int2ver "$(echo $supported_ver | $bb cut -d- -f1)");
- hi_ver=$(int2ver "$(echo $supported_ver | $bb cut -d- -f2)");
- if echo -e "$hi_ver\n$lo_ver\n$parsed_ver" | $bb sort -g | $bb grep -n "$parsed_ver" | $bb grep -q '^2:'; then
+ if echo $supported_ver | $BB grep -q '-'; then
+ lo_ver=$(int2ver "$(echo $supported_ver | $BB cut -d- -f1)");
+ hi_ver=$(int2ver "$(echo $supported_ver | $BB cut -d- -f2)");
+ if echo -e "$hi_ver\n$lo_ver\n$parsed_ver" | $BB sort -g | $BB grep -n "$parsed_ver" | $BB grep -q '^2:'; then
supported=1;
fi;
else
- for ver in $(echo $supported_ver | $bb sed 's;,; ;g'); do
+ for ver in $(echo $supported_ver | $BB sed 's;,; ;g'); do
if [ "$(int2ver $ver)" == "$parsed_ver" ]; then
supported=1;
break;
@@ -274,80 +304,176 @@ if [ "$supported_ver" ]; then
done;
fi;
if [ "$supported" ]; then
- ui_print " - Android Version: $android_ver";
+ ui_print "$android_ver" " ";
else
- abort " - Unsupported Android version. Aborting...";
+ abort " " "Unsupported Android version. Aborting...";
fi;
-fi;
-
-supported_lvl=$(file_getprop anykernel.sh supported.patchlevels | $bb grep -oE '[0-9]{4}-[0-9]{2}|-');
-if [ "$supported_lvl" ]; then
- ui_print " - Checking Android security patch level...";
+}
+do_levelcheck() {
+ [ "$(file_getprop anykernel.sh supported.patchlevels)" ] || return 1;
+ local android_lvl hi_lvl lo_lvl parsed_lvl supported_lvl;
+ ui_print "Checking Android security patch level...";
+ supported_lvl=$(file_getprop anykernel.sh supported.patchlevels | $BB grep -oE '[0-9]{4}-[0-9]{2}|-');
android_lvl=$(file_getprop /system/build.prop ro.build.version.security_patch);
- parsed_lvl=$(echo $android_lvl | $bb grep -oE '[0-9]{4}-[0-9]{2}');
- if echo $supported_lvl | $bb grep -q '^\-'; then
+ parsed_lvl=$(echo $android_lvl | $BB grep -oE '[0-9]{4}-[0-9]{2}');
+ if echo $supported_lvl | $BB grep -q '^\-'; then
lo_lvl=0000-00;
- hi_lvl=$(echo $supported_lvl | $bb awk '{ print $2 }');
- elif echo $supported_lvl | $bb grep -q ' - '; then
- lo_lvl=$(echo $supported_lvl | $bb awk '{ print $1 }');
- hi_lvl=$(echo $supported_lvl | $bb awk '{ print $3 }');
- elif echo $supported_lvl | $bb grep -q '\-$'; then
- lo_lvl=$(echo $supported_lvl | $bb awk '{ print $1 }');
+ hi_lvl=$(echo $supported_lvl | $BB awk '{ print $2 }');
+ elif echo $supported_lvl | $BB grep -q ' - '; then
+ lo_lvl=$(echo $supported_lvl | $BB awk '{ print $1 }');
+ hi_lvl=$(echo $supported_lvl | $BB awk '{ print $3 }');
+ elif echo $supported_lvl | $BB grep -q '\-$'; then
+ lo_lvl=$(echo $supported_lvl | $BB awk '{ print $1 }');
hi_lvl=9999-99;
fi;
- if echo -e "$hi_lvl\n$lo_lvl\n$parsed_lvl" | $bb sort -g | $bb grep -n "$parsed_lvl" | $bb grep -q '^2:'; then
+ if echo -e "$hi_lvl\n$lo_lvl\n$parsed_lvl" | $BB sort -g | $BB grep -n "$parsed_lvl" | $BB grep -q '^2:'; then
ui_print "$android_lvl" " ";
else
- abort " - Unsupported Android security patch level. Aborting...";
+ abort " " "Unsupported Android security patch level. Aborting...";
fi;
+}
+dump_moduleinfo() {
+cat <<EOF > $1;
+name=AK3 Helper Module
+version=$($BB awk '{ print $3 }' $AKHOME/vertmp) $($BB grep -oE '#.[0-9]' $AKHOME/vertmp)
+versionCode=1
+author=AnyKernel3
+description=$KERNEL_STRING
+EOF
+}
+dump_moduleremover() {
+cat <<'EOF' > $1;
+#!/system/bin/sh
+MODDIR=${0%/*};
+if [ "$(cat /proc/version)" != "$(cat $MODDIR/version)" ]; then
+ rm -rf $MODDIR;
fi;
-
-ui_print " - Installing kernel...";
-core=$($bb grep -oE 'ak.*core.sh' anykernel.sh);
-test -f tools/$core || $bb ln -s $home/tools/ak*-core.sh $home/tools/$core;
-PATH="$home/bin:$PATH" home=$home $bb ash anykernel.sh $2;
-if [ $? != 0 ]; then
- abort;
-fi;
-
-if [ "$(file_getprop anykernel.sh do.modules)" == 1 ]; then
- ui_print " - Pushing modules...";
- $bb mount -o rw,remount -t auto /system;
- $bb mount -o rw,remount -t auto /vendor 2>/dev/null;
- cd $home/modules;
- for module in $(find . -name '*.ko'); do
- modtarget=$(echo $module | $bb cut -c2-);
- if [ ! -e $modtarget ]; then
- case $module in
- */vendor/*) modcon=vendor;;
- *) modcon=system;;
- esac;
+EOF
+}
+do_modules() {
+ [ "$(file_getprop anykernel.sh do.modules)" == 1 ] || return 1;
+ local block modcon moddir modtarget module slot umask;
+ if [ "$(file_getprop anykernel.sh do.systemless)" == 1 ]; then
+ cd $AKHOME/modules;
+ ui_print " " "Creating kernel helper Magisk module...";
+ if [ -d /data/adb/magisk -a -f $AKHOME/split_img/.magisk ]; then
+ umask=$(umask);
+ umask 022;
+ moddir=/data/adb/modules/ak3-helper;
+ rm -rf $moddir;
+ mkdir -p system $moddir;
+ ($BB mv -f product system;
+ $BB mv -f vendor system) 2>/dev/null;
+ $BB cp -rLf * $moddir;
+ dump_moduleinfo $moddir/module.prop;
+ dump_moduleremover $moddir/post-fs-data.sh;
+ cp -f $AKHOME/vertmp $moddir/version;
+ umask $umask;
+ else
+ ui_print "Magisk installation not found. Skipped!";
fi;
- if is_mounted $modtarget; then
- $bb mount -o rw,remount -t auto $modtarget;
+ else
+ cd $AKHOME/modules;
+ ui_print " " "Pushing modules...";
+ if [ -d /dev/block/mapper ]; then
+ for block in system vendor product; do
+ for slot in "" _a _b; do
+ $BB blockdev --setrw /dev/block/mapper/$block$slot 2>/dev/null;
+ done;
+ done;
fi;
- mkdir -p $(dirname $modtarget);
- $bb cp -rLf $module $modtarget;
- $bb chown 0:0 $modtarget;
- $bb chmod 644 $modtarget;
- if [ "$modcon" ]; then
- chcon "u:object_r:${modcon}_file:s0" $modtarget;
+ if [ ! -d /postinstall/tmp ]; then
+ $BB mount -o rw,remount -t auto /system;
+ ($BB mount -o rw,remount -t auto /vendor;
+ $BB mount -o rw,remount -t auto /product) 2>/dev/null;
fi;
- if is_mounted $modtarget; then
- $bb mount -o ro,remount -t auto $modtarget;
+ for module in $(find . -name '*.ko'); do
+ modtarget=$POSTINSTALL$(echo $module | $BB cut -c2-);
+ if [ ! -e $modtarget ]; then
+ case $module in
+ */vendor/*) modcon=vendor;;
+ */product/*) modcon=product;;
+ *) modcon=system;;
+ esac;
+ fi;
+ if is_mounted $modtarget; then
+ $BB mount -o rw,remount -t auto $modtarget;
+ fi;
+ mkdir -p $(dirname $modtarget);
+ $BB cp -rLf $module $modtarget;
+ $BB chown 0:0 $modtarget;
+ $BB chmod 644 $modtarget;
+ if [ "$modcon" ]; then
+ chcon "u:object_r:${modcon}_file:s0" $modtarget;
+ fi;
+ if is_mounted $modtarget; then
+ $BB mount -o ro,remount -t auto $modtarget;
+ fi;
+ done;
+ if [ ! -d /postinstall/tmp ]; then
+ $BB mount -o ro,remount -t auto /system;
+ ($BB mount -o ro,remount -t auto /vendor;
+ $BB mount -o ro,remount -t auto /product) 2>/dev/null;
fi;
- done;
- cd $home;
- $bb mount -o ro,remount -t auto /system;
- $bb mount -o ro,remount -t auto /vendor 2>/dev/null;
+ fi;
+ cd $AKHOME;
+}
+
+show_progress 1.34 4;
+ui_print " ";
+cleanup;
+mkdir -p $AKHOME/bin;
+cd $AKHOME;
+unzip -o "$ZIPFILE";
+if [ $? != 0 -o ! "$(ls tools)" ]; then
+ abort "Unzip failed. Aborting...";
+fi;
+for ARCH32 in x86 arm; do
+ if [ -d $AKHOME/tools/$ARCH32 ]; then
+ BB=$AKHOME/tools/$ARCH32/busybox;
+ chmod 755 $BB;
+ $BB >/dev/null 2>&1;
+ if [ $? == 0 ]; then
+ $BB mv -f $AKHOME/tools/$ARCH32/* $AKHOME/tools;
+ break;
+ fi;
+ fi;
+done;
+BB=$AKHOME/tools/busybox;
+chmod 755 $BB;
+$BB chmod -R 755 tools bin;
+$BB --install -s bin;
+if [ $? != 0 -o -z "$(ls bin)" ]; then
+ abort "Busybox setup failed. Aborting...";
fi;
+KERNEL_STRING="$(file_getprop anykernel.sh kernel.string)";
+ui_print "$KERNEL_STRING";
+if [ -f version ]; then
+ ui_print " ";
+ ui_printfile version;
+ ui_print " ";
+fi;
+
+setup_env;
+
+do_devicecheck;
+do_versioncheck;
+do_levelcheck;
+
+ui_print "Installing...";
+CORE=$($BB grep -oE 'ak.*core.sh' anykernel.sh);
+[ -f tools/$CORE ] || $BB ln -s $AKHOME/tools/ak*-core.sh $AKHOME/tools/$CORE;
+PATH="$AKHOME/bin:$PATH" home=$AKHOME $BB ash anykernel.sh $2;
+if [ $? != 0 ]; then
+ abort;
+fi;
+
+do_modules;
+
debugging;
restore_env;
if [ "$(file_getprop anykernel.sh do.cleanup)" == 1 ]; then
- ui_print " - Cleaning up...";
cleanup;
fi;
-
-ui_print " - Done!";
diff --git a/anykernel.sh b/anykernel.sh
index 45eb297..7e60d63 100755
--- a/anykernel.sh
+++ b/anykernel.sh
@@ -10,7 +10,7 @@ do.modules=0
do.cleanup=1
do.cleanuponabort=0
device.name1=lavender
-supported.versions=9 - 10
+supported.versions=9 - 12
supported.patchlevels=
'; } # end properties
diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh
index af32439..2e361b5 100755
--- a/tools/ak3-core.sh
+++ b/tools/ak3-core.sh
@@ -4,7 +4,7 @@
OUTFD=$1;
# set up working directory variables
-test "$home" || home=$PWD;
+[ "$home" ] || home=$PWD;
bootimg=$home/boot.img;
bin=$home/tools;
patch=$home/patch;
@@ -15,7 +15,8 @@ split_img=$home/split_img;
# ui_print "<text>" [...]
ui_print() {
until [ ! "$1" ]; do
- echo -e "ui_print $1\nui_print" > /proc/self/fd/$OUTFD;
+ echo "ui_print $1
+ ui_print" >> /proc/self/fd/$OUTFD;
shift;
done;
}
@@ -28,7 +29,7 @@ abort() {
# contains <string> <substring>
contains() {
- test "${1#*$2}" != "$1";
+ [ "${1#*$2}" != "$1" ];
}
# file_getprop <file> <property>
@@ -80,7 +81,7 @@ split_boot() {
else
dd if=$block of=$bootimg $customdd;
fi;
- test $? != 0 && dumpfail=1;
+ [ $? != 0 ] && dumpfail=1;
mkdir -p $split_img;
cd $split_img;
@@ -90,9 +91,9 @@ split_boot() {
$bin/elftool unpack -i $bootimg -o elftool_out;
fi;
$bin/unpackelf -i $bootimg;
- test $? != 0 && dumpfail=1;
- mv -f boot.img-zImage kernel.gz;
- mv -f boot.img-ramdisk.cpio.gz ramdisk.cpio.gz;
+ [ $? != 0 ] && dumpfail=1;
+ mv -f boot.img-kernel kernel.gz;
+ mv -f boot.img-ramdisk ramdisk.cpio.gz;
mv -f boot.img-cmdline cmdline.txt 2>/dev/null;
if [ -f boot.img-dt -a ! -f "$bin/elftool" ]; then
case $(od -ta -An -N4 boot.img-dt | sed -e 's/ del//' -e 's/ //g') in
@@ -117,7 +118,7 @@ split_boot() {
grep "Address:" header | cut -c15- > boot.img-addr;
grep "Point:" header | cut -c15- > boot.img-ep;
$bin/dumpimage -p 0 -o kernel.gz boot-trimmed.img;
- test $? != 0 && dumpfail=1;
+ [ $? != 0 ] && dumpfail=1;
case $(cat boot.img-type) in
Multi) $bin/dumpimage -p 1 -o ramdisk.cpio.gz boot-trimmed.img;;
RAMDisk) mv -f kernel.gz ramdisk.cpio.gz;;
@@ -165,7 +166,7 @@ unpack_ramdisk() {
fi;
fi;
- test -d $ramdisk && mv -f $ramdisk $home/rdtmp;
+ [ -d $ramdisk ] && mv -f $ramdisk $home/rdtmp;
mkdir -p $ramdisk;
chmod 755 $ramdisk;
@@ -207,18 +208,18 @@ repack_ramdisk() {
cd $ramdisk;
find . | cpio -H newc -o > $home/ramdisk-new.cpio;
fi;
- test $? != 0 && packfail=1;
+ [ $? != 0 ] && packfail=1;
cd $home;
$bin/magiskboot cpio ramdisk-new.cpio test;
magisk_patched=$?;
- test $((magisk_patched & 3)) -eq 1 && $bin/magiskboot cpio ramdisk-new.cpio "extract .backup/.magisk $split_img/.magisk";
+ [ $((magisk_patched & 3)) -eq 1 ] && $bin/magiskboot cpio ramdisk-new.cpio "extract .backup/.magisk $split_img/.magisk";
if [ "$comp" ]; then
$bin/magiskboot compress=$comp ramdisk-new.cpio;
if [ $? != 0 ]; then
echo "Attempting ramdisk repack with busybox $comp..." >&2;
$comp -9c ramdisk-new.cpio > ramdisk-new.cpio.$comp;
- test $? != 0 && packfail=1;
+ [ $? != 0 ] && packfail=1;
rm -f ramdisk-new.cpio;
fi;
fi;
@@ -243,7 +244,7 @@ flash_boot() {
varlist="name arch os type comp addr ep";
elif [ -f "$bin/mkbootimg" -a -f "$bin/unpackelf" -a -f boot.img-base ]; then
mv -f cmdline.txt boot.img-cmdline 2>/dev/null;
- varlist="cmdline base pagesize kerneloff ramdiskoff tagsoff";
+ varlist="cmdline base pagesize kernel_offset ramdisk_offset tags_offset";
fi;
for i in $varlist; do
if [ -f boot.img-$i ]; then
@@ -284,7 +285,7 @@ flash_boot() {
cd $split_img;
if [ -f "$bin/mkimage" ]; then
- test "$comp" == "uncompressed" && comp=none;
+ [ "$comp" == "uncompressed" ] && comp=none;
part0=$kernel;
case $type in
Multi) part1=":$ramdisk";;
@@ -292,8 +293,8 @@ flash_boot() {
esac;
$bin/mkimage -A $arch -O $os -T $type -C $comp -a $addr -e $ep -n "$name" -d $part0$part1 $home/boot-new.img;
elif [ -f "$bin/elftool" ]; then
- test "$dt" && dt="$dt,rpm";
- test -f cmdline.txt && cmdline="cmdline.txt@cmdline";
+ [ "$dt" ] && dt="$dt,rpm";
+ [ -f cmdline.txt ] && cmdline="cmdline.txt@cmdline";
$bin/elftool pack -o $home/boot-new.img header=elftool_out/header $kernel $ramdisk,ramdisk $dt $cmdline;
elif [ -f "$bin/mboot" ]; then
cp -f $kernel kernel;
@@ -302,14 +303,14 @@ flash_boot() {
elif [ -f "$bin/rkcrc" ]; then
$bin/rkcrc -k $ramdisk $home/boot-new.img;
elif [ -f "$bin/mkbootimg" -a -f "$bin/unpackelf" -a -f boot.img-base ]; then
- test "$dt" && dt="--dt $dt";
- $bin/mkbootimg --kernel $kernel --ramdisk $ramdisk --cmdline "$cmdline" --base $home --pagesize $pagesize --kernel_offset $kerneloff --ramdisk_offset $ramdiskoff --tags_offset "$tagsoff" $dt --output $home/boot-new.img;
+ [ "$dt" ] && dt="--dt $dt";
+ $bin/mkbootimg --kernel $kernel --ramdisk $ramdisk --cmdline "$cmdline" --base $base --pagesize $pagesize --kernel_offset $kernel_offset --ramdisk_offset $ramdisk_offset --tags_offset "$tags_offset" $dt --output $home/boot-new.img;
else
- test "$kernel" && cp -f $kernel kernel;
- test "$ramdisk" && cp -f $ramdisk ramdisk.cpio;
- test "$dt" -a -f extra && cp -f $dt extra;
+ [ "$kernel" ] && cp -f $kernel kernel;
+ [ "$ramdisk" ] && cp -f $ramdisk ramdisk.cpio;
+ [ "$dt" -a -f extra ] && cp -f $dt extra;
for i in dtb recovery_dtbo; do
- test "$(eval echo \$$i)" -a -f $i && cp -f $(eval echo \$$i) $i;
+ [ "$(eval echo \$$i)" -a -f $i ] && cp -f $(eval echo \$$i) $i;
done;
case $kernel in
*Image*)
@@ -318,8 +319,7 @@ flash_boot() {
magisk_patched=$?;
fi;
if [ $((magisk_patched & 3)) -eq 1 ]; then
- ui_print " - Magisk detected! Patching kernel";
- ui_print " so reflashing Magisk is not necessary...";
+ ui_print " " "Magisk detected! Patching kernel so reflashing Magisk is not necessary...";
comp=$($bin/magiskboot decompress kernel 2>&1 | grep -v 'raw' | sed -n 's;.*\[\(.*\)\];\1;p');
($bin/magiskboot split $kernel || $bin/magiskboot decompress $kernel kernel) 2>/dev/null;
if [ $? != 0 -a "$comp" ]; then
@@ -327,6 +327,9 @@ flash_boot() {
$comp -dc $kernel > kernel;
fi;
$bin/magiskboot hexpatch kernel 736B69705F696E697472616D667300 77616E745F696E697472616D667300;
+ if [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then
+ strings kernel | grep -E 'Linux version.*#' > $home/vertmp;
+ fi;
if [ "$comp" ]; then
$bin/magiskboot compress=$comp kernel kernel.$comp;
if [ $? != 0 ]; then
@@ -335,11 +338,11 @@ flash_boot() {
fi;
mv -f kernel.$comp kernel;
fi;
- test ! -f .magisk && $bin/magiskboot cpio ramdisk.cpio "extract .backup/.magisk .magisk";
+ [ ! -f .magisk ] && $bin/magiskboot cpio ramdisk.cpio "extract .backup/.magisk .magisk";
export $(cat .magisk);
- test $((magisk_patched & 8)) -ne 0 && export TWOSTAGEINIT=true;
+ [ $((magisk_patched & 8)) -ne 0 ] && export TWOSTAGEINIT=true;
for fdt in dtb extra kernel_dtb recovery_dtbo; do
- test -f $fdt && $bin/magiskboot dtb $fdt patch;
+ [ -f $fdt ] && $bin/magiskboot dtb $fdt patch;
done;
else
case $kernel in
@@ -364,18 +367,18 @@ flash_boot() {
echo "Signing with CHROMEOS..." >&2;
$bin/futility vbutil_kernel --pack boot-new-signed.img --keyblock $bin/chromeos/kernel.keyblock --signprivate $bin/chromeos/kernel_data_key.vbprivk --version 1 --vmlinuz boot-new.img --bootloader $bin/chromeos/empty --config $bin/chromeos/empty --arch arm --flags 0x1;
fi;
- test $? != 0 && signfail=1;
+ [ $? != 0 ] && signfail=1;
fi;
- if [ -f "$bin/BootSignature_Android.jar" -a -d "$bin/avb" ]; then
+ if [ -f "$bin/boot_signer-dexed.jar" -a -d "$bin/avb" ]; then
pk8=$(ls $bin/avb/*.pk8);
cert=$(ls $bin/avb/*.x509.*);
case $block in
*recovery*|*SOS*) avbtype=recovery;;
*) avbtype=boot;;
esac;
- if [ "$(/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/BootSignature_Android.jar com.android.verity.BootSignature -verify boot.img 2>&1 | grep VALID)" ]; then
+ if [ "$(/system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature -verify boot.img 2>&1 | grep VALID)" ]; then
echo "Signing with AVBv1..." >&2;
- /system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/BootSignature_Android.jar com.android.verity.BootSignature /$avbtype boot-new.img $pk8 $cert boot-new-signed.img;
+ /system/bin/dalvikvm -Xnoimage-dex2oat -cp $bin/boot_signer-dexed.jar com.android.verity.BootSignature /$avbtype boot-new.img $pk8 $cert boot-new-signed.img;
fi;
fi;
if [ $? != 0 -o "$signfail" ]; then
@@ -388,6 +391,7 @@ flash_boot() {
elif [ "$(wc -c < boot-new.img)" -gt "$(wc -c < boot.img)" ]; then
abort "New image larger than boot partition. Aborting...";
fi;
+ blockdev --setrw $block 2>/dev/null;
if [ -f "$bin/flash_erase" -a -f "$bin/nandwrite" ]; then
$bin/flash_erase $block 0 0;
$bin/nandwrite -p $block boot-new.img;
@@ -419,6 +423,7 @@ flash_dtbo() {
if [ ! -e "$dtboblock" ]; then
abort "dtbo partition could not be found. Aborting...";
fi;
+ blockdev --setrw $dtboblock 2>/dev/null;
if [ -f "$bin/flash_erase" -a -f "$bin/nandwrite" ]; then
$bin/flash_erase $dtboblock 0 0;
$bin/nandwrite -p $dtboblock $dtbo;
@@ -443,14 +448,14 @@ write_boot() {
### file editing functions:
# backup_file <file>
-backup_file() { test ! -f $1~ && cp -fp $1 $1~; }
+backup_file() { [ ! -f $1~ ] && cp -fp $1 $1~; }
# restore_file <file>
-restore_file() { test -f $1~ && cp -fp $1~ $1; rm -f $1~; }
+restore_file() { [ -f $1~ ] && cp -fp $1~ $1; rm -f $1~; }
# replace_string <file> <if search string> <original string> <replacement string> <scope>
replace_string() {
- test "$5" == "global" && local scope=g;
+ [ "$5" == "global" ] && local scope=g;
if ! grep -q "$2" $1; then
sed -i "s;${3};${4};${scope}" $1;
fi;
@@ -470,7 +475,7 @@ replace_section() {
for end in $(grep -n "$endstr" $1 | cut -d: -f1) $last; do
if [ "$end" ] && [ "$begin" -lt "$end" ]; then
sed -i "${begin},${end}d" $1;
- test "$end" == "$last" && echo >> $1;
+ [ "$end" == "$last" ] && echo >> $1;
sed -i "${begin}s;^;${4}\n;" $1;
break;
fi;
@@ -515,19 +520,27 @@ insert_line() {
fi;
}
-# replace_line <file> <line replace string> <replacement line>
+# replace_line <file> <line replace string> <replacement line> <scope>
replace_line() {
+ local lines line;
if grep -q "$2" $1; then
- local line=$(grep -n "$2" $1 | head -n1 | cut -d: -f1);
- sed -i "${line}s;.*;${3};" $1;
+ lines=$(grep -n "$2" $1 | cut -d: -f1 | sort -nr);
+ [ "$4" == "global" ] || lines=$(echo "$lines" | tail -n1);
+ for line in $lines; do
+ sed -i "${line}s;.*;${3};" $1;
+ done;
fi;
}
-# remove_line <file> <line match string>
+# remove_line <file> <line match string> <scope>
remove_line() {
+ local lines line;
if grep -q "$2" $1; then
- local line=$(grep -n "$2" $1 | head -n1 | cut -d: -f1);
- sed -i "${line}d" $1;
+ lines=$(grep -n "$2" $1 | cut -d: -f1 | sort -nr);
+ [ "$3" == "global" ] || lines=$(echo "$lines" | tail -n1);
+ for line in $lines; do
+ sed -i "${line}d" $1;
+ done;
fi;
}
@@ -643,14 +656,14 @@ reset_ak() {
if [ -d "$current" ]; then
rm -rf $current/ramdisk;
for i in $bootimg boot-new.img; do
- test -e $i && cp -af $i $current;
+ [ -e $i ] && cp -af $i $current;
done;
fi;
- test -d $split_img && rm -rf $ramdisk;
+ [ -d $split_img ] && rm -rf $ramdisk;
rm -rf $bootimg $split_img $home/*-new* $home/*-files/current;
if [ "$1" == "keep" ]; then
- test -d $home/rdtmp && mv -f $home/rdtmp $ramdisk;
+ [ -d $home/rdtmp ] && mv -f $home/rdtmp $ramdisk;
else
rm -rf $patch $home/rdtmp;
fi;
@@ -676,13 +689,16 @@ setup_ak() {
case $is_slot_device in
1|auto)
slot=$(getprop ro.boot.slot_suffix 2>/dev/null);
- test "$slot" || slot=$(grep -o 'androidboot.slot_suffix=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2);
+ [ "$slot" ] || slot=$(grep -o 'androidboot.slot_suffix=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2);
if [ ! "$slot" ]; then
slot=$(getprop ro.boot.slot 2>/dev/null);
- test "$slot" || slot=$(grep -o 'androidboot.slot=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2);
- test "$slot" && slot=_$slot;
+ [ "$slot" ] || slot=$(grep -o 'androidboot.slot=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2);
+ [ "$slot" ] && slot=_$slot;
fi;
if [ "$slot" ]; then
+ if [ -d /postinstall/tmp -a ! "$slot_select" ]; then
+ slot_select=inactive;
+ fi;
case $slot_select in
inactive)
case $slot in
@@ -732,7 +748,7 @@ setup_ak() {
elif [ -e /dev/$part ]; then
target=/dev/$part;
fi;
- test "$target" && break 2;
+ [ "$target" ] && break 2;
done;
done;
if [ "$target" ]; then
@@ -743,10 +759,13 @@ setup_ak() {
;;
*)
if [ "$slot" ]; then
- test -e "$block$slot" && block=$block$slot;
+ [ -e "$block$slot" ] && block=$block$slot;
fi;
;;
esac;
+ if [ ! "$no_block_display" ]; then
+ ui_print "$block";
+ fi;
}
###