summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorosm0sis <osm0sis@outlook.com>2019-05-09 16:13:47 -0300
committerosm0sis <osm0sis@outlook.com>2019-05-09 16:13:47 -0300
commit1a143d730641dc5f0404e87c4c81f82cdda94dc3 (patch)
tree390b5179614f126e66988460baa1f5249f08fe51 /tools
parentc3e298ecc6e778d4dfe16a62a959204f130b6a1c (diff)
AK2: add support for multi-slot zips
- extend `reset_ak` with `reset_ak keep` which will keep files to be available to patch the other slot - add optional slot_select=inactive shell variable to force inactive slot during slot detection
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ak2-core.sh29
1 files changed, 23 insertions, 6 deletions
diff --git a/tools/ak2-core.sh b/tools/ak2-core.sh
index e91c684..a875a71 100755
--- a/tools/ak2-core.sh
+++ b/tools/ak2-core.sh
@@ -22,14 +22,21 @@ contains() { test "${1#*$2}" != "$1" && return 0 || return 1; }
# file_getprop <file> <property>
file_getprop() { grep "^$2=" "$1" | cut -d= -f2-; }
-# reset anykernel directory
+# reset_ak [keep]
reset_ak() {
local i;
- rm -rf $(dirname /tmp/anykernel/*-files/current)/ramdisk;
- for i in $ramdisk $split_img /tmp/anykernel/rdtmp /tmp/anykernel/boot.img /tmp/anykernel/*-new*; do
- cp -af $i $(dirname /tmp/anykernel/*-files/current);
- done;
- rm -rf $ramdisk $split_img $patch /tmp/anykernel/rdtmp /tmp/anykernel/boot.img /tmp/anykernel/*-new* /tmp/anykernel/*-files/current;
+ if [ ! "$1" == "keep" ]; then
+ rm -rf $(dirname /tmp/anykernel/*-files/current)/ramdisk;
+ for i in $ramdisk $split_img /tmp/anykernel/rdtmp /tmp/anykernel/boot.img /tmp/anykernel/*-new*; do
+ cp -af $i $(dirname /tmp/anykernel/*-files/current);
+ done;
+ fi;
+ rm -rf $ramdisk $split_img /tmp/anykernel/boot.img /tmp/anykernel/*-new* /tmp/anykernel/*-files/current;
+ if [ "$1" == "keep" ]; then
+ mv -f /tmp/anykernel/rdtmp $ramdisk;
+ else
+ rm -rf $patch /tmp/anykernel/rdtmp;
+ fi;
. /tmp/anykernel/tools/ak2-core.sh $FD;
}
@@ -609,6 +616,16 @@ case $is_slot_device in
test ! "$slot" && slot=$(grep -o 'androidboot.slot=.*$' /proc/cmdline | cut -d\ -f1 | cut -d= -f2);
test "$slot" && slot=_$slot;
fi;
+ if [ "$slot" ]; then
+ case $slot_select in
+ inactive)
+ case $slot in
+ _a) slot=_b;;
+ _b) slot=_a;;
+ ;;
+ ;;
+ esac;
+ fi;
if [ ! "$slot" -a "$is_slot_device" == 1 ]; then
ui_print " "; ui_print "Unable to determine active boot slot. Aborting..."; exit 1;
fi;