Skip to content

Commit e95eec2

Browse files
committed
Add fallback busybox to prevent failure
1 parent 4fa2d4b commit e95eec2

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

app/src/main/assets/flash_ak3.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/system/bin/sh
22

33
## setup for testing:
4-
unzip -p "$Z" tools*/busybox > $F/busybox;
4+
unzip -p "$Z" tools*/busybox > $F/busybox_ak;
55
unzip -p "$Z" META-INF/com/google/android/update-binary > $F/update-binary;
66
##
77

8-
chmod 755 $F/busybox;
8+
chmod 755 $F/busybox_ak;
9+
$F/busybox_ak >/dev/null 2>&1
10+
if [ $? -eq 0 ]; then
11+
mv $F/busybox $F/busybox_orig
12+
mv $F/busybox_ak $F/busybox
13+
fi
914
$F/busybox chmod 755 $F/update-binary;
1015
$F/busybox chown root:root $F/busybox $F/update-binary;
1116

@@ -18,6 +23,9 @@ $F/busybox mkdir -p $TMP;
1823
$F/busybox mount -t tmpfs -o noatime tmpfs $TMP;
1924
#$F/busybox mount | $F/busybox grep -q " $TMP " || exit 1;
2025

26+
PATTERN='\$[Bb][Bb] chmod -R 755 tools bin;';
27+
sed -i "/$PATTERN/i cp -f \"\$F/busybox\" \$AKHOME/tools;" "$F/update-binary";
28+
2129
# update-binary <RECOVERY_API_VERSION> <OUTFD> <ZIPFILE>
2230
AKHOME=$TMP/anykernel $F/busybox ash $F/update-binary 3 1 "$Z";
2331
RC=$?;
@@ -26,6 +34,7 @@ $F/busybox umount $TMP;
2634
$F/busybox rm -rf $TMP;
2735
$F/busybox mount -o ro,remount -t auto /;
2836
$F/busybox rm -f $F/update-binary $F/busybox;
37+
mv $F/busybox_orig $F/busybox
2938

3039
# work around libsu not cleanly accepting return or exit as last line
3140
safereturn() { return $RC; }

app/src/main/assets/flash_ak3_mkbootfs.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/system/bin/sh
22

33
## setup for testing:
4-
unzip -p "$Z" tools*/busybox > $F/busybox;
4+
unzip -p "$Z" tools*/busybox > $F/busybox_ak;
55
unzip -p "$Z" META-INF/com/google/android/update-binary > $F/update-binary;
66
##
77

8-
chmod 755 $F/busybox;
8+
chmod 755 $F/busybox_ak;
9+
$F/busybox_ak >/dev/null 2>&1
10+
if [ $? -eq 0 ]; then
11+
mv $F/busybox $F/busybox_orig
12+
mv $F/busybox_ak $F/busybox
13+
fi
914
$F/busybox chmod 755 $F/update-binary;
1015
$F/busybox chown root:root $F/busybox $F/update-binary;
1116

@@ -20,6 +25,7 @@ $F/busybox mount -t tmpfs -o noatime tmpfs $TMP;
2025

2126
PATTERN='\$[Bb][Bb] chmod -R 755 tools bin;';
2227
sed -i "/$PATTERN/i cp -f \"\$F/mkbootfs\" \$AKHOME/tools;" "$F/update-binary";
28+
sed -i "/$PATTERN/i cp -f \"\$F/busybox\" \$AKHOME/tools;" "$F/update-binary";
2329

2430
# update-binary <RECOVERY_API_VERSION> <OUTFD> <ZIPFILE>
2531
AKHOME=$TMP/anykernel $F/busybox ash $F/update-binary 3 1 "$Z";
@@ -29,6 +35,7 @@ $F/busybox umount $TMP;
2935
$F/busybox rm -rf $TMP;
3036
$F/busybox mount -o ro,remount -t auto /;
3137
$F/busybox rm -f $F/update-binary $F/busybox;
38+
mv $F/busybox_orig $F/busybox
3239

3340
# work around libsu not cleanly accepting return or exit as last line
3441
safereturn() { return $RC; }

app/src/main/java/com/github/capntrips/kernelflasher/MainActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class MainActivity : ComponentActivity() {
195195
copyNativeBinary("httools_static") // v3.2.0
196196
copyNativeBinary("magiskboot") // v29.0
197197
copyNativeBinary("bootctl") // aosp_arm64-img-13613025 android14
198+
copyNativeBinary("busybox") // BusyBox v1.36.1.1
198199
copyAsset("mkbootfs")
199200
copyAsset("ksuinit")
200201
copyAsset("flash_ak3.sh")
1.63 MB
Binary file not shown.
1.22 MB
Binary file not shown.

0 commit comments

Comments
 (0)