Skip to content

Commit bd4ba60

Browse files
committed
AnyKernel2: custom user script support, fixes
- fix copy of any subdirectories under modules/ - adjust display of modules installation text to match the others - add support for custom user scripts (at /data/custom_boot_image_patch.sh - same as latest SuperSU zips) to automatically execute before reflashing the rebuilt boot image for bump, loki etc. modifications
1 parent af7a853 commit bd4ba60

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

META-INF/com/google/android/update-binary

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set_perm_recursive() {
2323
}
2424
file_getprop() { grep "^$2" "$1" | cut -d= -f2; }
2525
getprop() { test -e /sbin/getprop && /sbin/getprop $1 || file_getprop /default.prop $1; }
26-
abort() { ui_print "$*"; exit 1; }
26+
abort() { ui_print "$*"; umount /system; umount /data; exit 1; }
2727

2828
show_progress 1.34 4;
2929
ui_print " ";
@@ -39,6 +39,7 @@ ui_print " ";
3939
ui_print "AnyKernel2 by osm0sis @ xda-developers";
4040
ui_print " ";
4141
/sbin/busybox mount -o ro /system;
42+
/sbin/busybox mount /data;
4243

4344
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.devicecheck)" == 1 ]; then
4445
ui_print "Checking device...";
@@ -51,7 +52,6 @@ if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.devicecheck)" == 1 ]; then
5152
done;
5253
ui_print " ";
5354
if [ "$match" != 1 ]; then
54-
umount /system;
5555
abort "Unsupported device. Aborting...";
5656
fi;
5757
fi;
@@ -68,15 +68,14 @@ fi;
6868
ui_print "Installing kernel...";
6969
/sbin/sh /tmp/anykernel/anykernel.sh $2;
7070
if [ $? != "0" ]; then
71-
umount /system;
7271
abort;
7372
fi;
7473

7574
if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.modules)" == 1 ]; then
76-
ui_print "Pushing modules...";
7775
ui_print " ";
76+
ui_print "Pushing modules...";
7877
/sbin/busybox mount -o remount,rw /system;
79-
cp -f /tmp/anykernel/modules/* /system/lib/modules/;
78+
cp -rf /tmp/anykernel/modules/* /system/lib/modules/;
8079
set_perm_recursive 0 0 0755 0644 /system/lib/modules;
8180
/sbin/busybox mount -o remount,ro /system;
8281
fi;
@@ -86,6 +85,7 @@ if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.cleanup)" == 1 ]; then
8685
fi;
8786

8887
umount /system;
88+
umount /data;
8989
ui_print " ";
9090
ui_print "Done!";
9191

anykernel.sh

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ write_boot() {
8989
elif [ `wc -c < /tmp/anykernel/boot-new.img` -gt `wc -c < /tmp/anykernel/boot.img` ]; then
9090
ui_print " "; ui_print "New image larger than boot partition. Aborting..."; exit 1;
9191
fi;
92+
if [ -f "/data/custom_boot_image_patch.sh" ]; then
93+
sh /data/custom_boot_image_patch.sh /tmp/anykernel/boot-new.img;
94+
if [ $? != 0 ]; then
95+
ui_print " "; ui_print "User script execution failed. Aborting..."; exit 1;
96+
fi;
97+
fi;
9298
dd if=/tmp/anykernel/boot-new.img of=$block;
9399
}
94100

0 commit comments

Comments
 (0)