-
Notifications
You must be signed in to change notification settings - Fork 48
/
flash_ak3.sh
32 lines (24 loc) · 874 Bytes
/
flash_ak3.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/system/bin/sh
## setup for testing:
unzip -p $Z tools*/busybox > $F/busybox;
unzip -p $Z META-INF/com/google/android/update-binary > $F/update-binary;
##
chmod 755 $F/busybox;
$F/busybox chmod 755 $F/update-binary;
$F/busybox chown root:root $F/busybox $F/update-binary;
TMP=$F/tmp;
$F/busybox umount $TMP 2>/dev/null;
$F/busybox rm -rf $TMP 2>/dev/null;
$F/busybox mkdir -p $TMP;
$F/busybox mount -t tmpfs -o noatime tmpfs $TMP;
$F/busybox mount | $F/busybox grep -q " $TMP " || exit 1;
# update-binary <RECOVERY_API_VERSION> <OUTFD> <ZIPFILE>
AKHOME=$TMP/anykernel $F/busybox ash $F/update-binary 3 1 "$Z";
RC=$?;
$F/busybox umount $TMP;
$F/busybox rm -rf $TMP;
$F/busybox mount -o ro,remount -t auto /;
$F/busybox rm -f $F/update-binary $F/busybox;
# work around libsu not cleanly accepting return or exit as last line
safereturn() { return $RC; }
safereturn;