Backend: workaround toybox inclusion in Cyanogen Recovery

- add busybox to the zip to provide a uniform expected environment
- set up busybox symlinks in /tmp and execute anykernel.sh from a shell created with these at the front of the path, overriding the recovery applets
This commit is contained in:
osm0sis committed 2016-01-24 13:31:55 -04:00
1 parent 65520217ef
commit c79016cd39
2 files changed
+13 -8

No files matched your search

+13 -8
View File
@@ -27,7 +27,7 @@ abort() { ui_print "$*"; umount /system; umount /data; exit 1; }
show_progress 1.34 4;
ui_print " ";
mkdir -p /tmp/anykernel;
mkdir -p /tmp/anykernel/bin;
cd /tmp/anykernel;
unzip -o "$ZIP";
if [ $? != 0 -o -z "$(ls /tmp/anykernel)" ]; then
@@ -38,8 +38,8 @@ ui_print "$(file_getprop /tmp/anykernel/anykernel.sh kernel.string)";
ui_print " ";
ui_print "AnyKernel2 by osm0sis @ xda-developers";
ui_print " ";
/sbin/busybox mount -o ro /system;
/sbin/busybox mount /data;
mount -o ro /system;
mount /data;
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.devicecheck)" == 1 ]; then
ui_print "Checking device...";
@@ -59,14 +59,19 @@ fi;
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.initd)" == 1 ]; then
ui_print "Creating init.d...";
ui_print " ";
/sbin/busybox mount -o remount,rw /system;
mount -o remount,rw /system;
mkdir /system/etc/init.d;
set_perm_recursive 0 0 0755 0755 /system/etc/init.d;
/sbin/busybox mount -o remount,ro /system;
mount -o remount,ro /system;
fi;
ui_print "Installing kernel...";
/sbin/sh /tmp/anykernel/anykernel.sh $2;
chmod -R 755 /tmp/anykernel/tools /tmp/anykernel/bin;
bb=/tmp/anykernel/tools/busybox;
for i in $($bb --list); do
ln -s $bb /tmp/anykernel/bin/$i;
done;
PATH="/tmp/anykernel/bin:$PATH" $bb ash /tmp/anykernel/anykernel.sh $2;
if [ $? != "0" ]; then
abort;
fi;
@@ -74,10 +79,10 @@ fi;
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.modules)" == 1 ]; then
ui_print " ";
ui_print "Pushing modules...";
/sbin/busybox mount -o remount,rw /system;
mount -o remount,rw /system;
cp -rf /tmp/anykernel/modules/* /system/lib/modules/;
set_perm_recursive 0 0 0755 0644 /system/lib/modules;
/sbin/busybox mount -o remount,ro /system;
mount -o remount,ro /system;
fi;
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.cleanup)" == 1 ]; then
Executable
BIN
View File
Binary file not shown.