From 4e403f12e50736a9c9155aebdede1912773defac Mon Sep 17 00:00:00 2001 From: osm0sis Date: Mon, 17 Jun 2019 23:01:04 -0300 Subject: [PATCH] AK3: better living through sed - clean up magiskboot compression type output parsing --- tools/ak3-core.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index 8e05e08..ac04275 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -128,11 +128,11 @@ unpack_ramdisk() { fi; if [ -f ramdisk.cpio ]; then - comp=$($bin/magiskboot decompress ramdisk.cpio 2>&1 | head -n1 | cut -d[ -f2 | cut -d] -f1 | grep -v 'compressed'); + comp=$($bin/magiskboot decompress ramdisk.cpio 2>&1 | grep -v 'raw' | sed -n 's;.*\[\(.*\)\];\1;p'); else abort "No ramdisk found to unpack. Aborting..."; fi; - if [ "$comp" -a "$comp" != "raw" ]; then + if [ "$comp" ]; then mv -f ramdisk.cpio ramdisk.cpio.$comp; $bin/magiskboot decompress ramdisk.cpio.$comp ramdisk.cpio; if [ $? != 0 ]; then