AK3: better living through sed

- clean up magiskboot compression type output parsing
This commit is contained in:
osm0sis committed 2019-06-17 23:01:04 -03:00
1 parent 3685456911
commit 4e403f12e5
1 file changed
+2 -2
+2 -2
View File
@@ -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