Skip to content

Commit 4ac309d

Browse files
committed
Fixed issue with binary executables on Android 8+
1 parent a51839c commit 4ac309d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1485
-1316
lines changed

CHANGELOG

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Changelog
22
=========
33

4-
1.34.1-47
4+
1.34.1-50
55
Updated to busybox v1.34.1
6-
Fixed remounting for Android 9
6+
Fixed issues on Android 8+
77

88
1.31.1-45
99
Updated to busybox v1.31.1

README.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,9 @@ Latest BusyBox v1.34.1, supported 378 applets:
5252
**Requirements**:
5353

5454
* Device with architecture arm, arm64, x86, x86_64
55-
* Android 4.1 (API 16) or later
55+
* Android 8 (API 26) or later
5656
* Superuser permissions (root)
5757

58-
**Use without root permissions**
59-
60-
To access busybox tools without superuser privileges, perform the following command in Android terminal:
61-
62-
export PATH=/data/data/ru.meefik.busybox/files/bin:$PATH
63-
6458
**References**:
6559

6660
* [Source code](https://github.com/meefik/busybox)

app/build.gradle

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 30
5-
buildToolsVersion '29.0.2'
4+
compileSdkVersion 31
5+
buildToolsVersion '31.0.0'
66

77
defaultConfig {
88
applicationId 'ru.meefik.busybox'
9-
minSdkVersion 16
10-
targetSdkVersion 30
11-
versionCode 47
9+
minSdkVersion 26
10+
targetSdkVersion 31
11+
versionCode 51
1212
versionName '1.34.1'
1313
}
1414
buildTypes {
1515
release {
1616
minifyEnabled true
1717
shrinkResources true
18-
proguardFiles 'proguard-rules.pro'
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1919
}
2020
}
2121
lintOptions {
2222
disable 'MissingTranslation'
2323
disable 'ExtraTranslation'
2424
}
25-
ndkVersion 'r15c'
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
packagingOptions {
30+
doNotStrip '**/*'
31+
exclude 'jniLibs/all/*'
32+
jniLibs {
33+
useLegacyPackaging true
34+
}
35+
}
36+
}
37+
38+
repositories {
39+
maven { url 'https://jitpack.io' }
2640
}
2741

2842
dependencies {
29-
implementation 'com.google.android.material:material:1.3.0'
30-
implementation 'androidx.appcompat:appcompat:1.3.0'
43+
implementation 'androidx.appcompat:appcompat:1.4.0'
44+
implementation 'com.github.topjohnwu.libsu:core:3.2.1'
45+
}
46+
47+
tasks.matching { it.name == "extractReleaseNativeSymbolTables" }.configureEach {
48+
it.enabled = false
3149
}

app/debug/output-metadata.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "ru.meefik.busybox",
8+
"variantName": "debug",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 50,
15+
"versionName": "1.34.1",
16+
"outputFile": "app-debug.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}

app/src/main/AndroidManifest.xml

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
43
package="ru.meefik.busybox"
4+
android:extractNativeLibs="true"
55
android:installLocation="internalOnly">
66

77
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
88
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
99

1010
<application
11+
android:allowBackup="true"
12+
android:fullBackupOnly="true"
1113
android:icon="@mipmap/ic_launcher"
1214
android:label="@string/app_name"
13-
android:theme="@style/DarkTheme"
14-
android:supportsRtl="true"
1515
android:requestLegacyExternalStorage="true"
16-
tools:ignore="GoogleAppIndexingWarning">
16+
android:supportsRtl="true"
17+
android:theme="@style/DarkTheme">
18+
<activity
19+
android:name=".BaseActivity"
20+
android:exported="false" />
1721
<activity
1822
android:name=".MainActivity"
23+
android:exported="true"
1924
android:label="@string/app_name"
2025
android:launchMode="singleTop">
2126
<intent-filter>
@@ -35,11 +40,11 @@
3540
<activity
3641
android:name=".AboutActivity"
3742
android:label="@string/title_activity_about"
38-
android:parentActivityName=".MainActivity" >
43+
android:parentActivityName=".MainActivity">
3944
<meta-data
4045
android:name="android.support.PARENT_ACTIVITY"
4146
android:value=".MainActivity" />
4247
</activity>
4348
</application>
4449

45-
</manifest>
50+
</manifest>

app/src/main/_jni/Android.mk

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
LOCAL_PATH := $(call my-dir)
2+
3+
include $(CLEAR_VARS)
4+
LOCAL_MODULE := librecovery
5+
LOCAL_SRC_FILES := stub.c
6+
include $(BUILD_SHARED_LIBRARY)
7+
8+
include $(CLEAR_VARS)
9+
LOCAL_MODULE := libssl_helper
10+
LOCAL_SRC_FILES := stub.c
11+
include $(BUILD_SHARED_LIBRARY)
12+
13+
include $(CLEAR_VARS)
14+
LOCAL_MODULE := libaddon_d
15+
LOCAL_SRC_FILES := stub.c
16+
include $(BUILD_SHARED_LIBRARY)
17+
18+
include $(CLEAR_VARS)
19+
LOCAL_MODULE := libinfo
20+
LOCAL_SRC_FILES := stub.c
21+
include $(BUILD_SHARED_LIBRARY)
22+
23+
include $(CLEAR_VARS)
24+
LOCAL_MODULE := libinstall
25+
LOCAL_SRC_FILES := stub.c
26+
include $(BUILD_SHARED_LIBRARY)
27+
28+
include $(CLEAR_VARS)
29+
LOCAL_MODULE := libbusybox
30+
LOCAL_SRC_FILES := stub.c
31+
include $(BUILD_SHARED_LIBRARY)
32+
33+
include $(CLEAR_VARS)
34+
LOCAL_MODULE := libremove
35+
LOCAL_SRC_FILES := stub.c
36+
include $(BUILD_SHARED_LIBRARY)
37+

app/src/main/_jni/Application.mk

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_ABI := all
2+
APP_STRIP_MODE := none

app/src/main/_jni/stub.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <jni.h>
2+
3+
int main() {
4+
return 0;
5+
}
File renamed without changes.

app/src/main/_libs/all/info.sh

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/system/bin/sh
2+
# BusyBox information
3+
# (c) 2015-2022 Anton Skshidlevsky <meefik@gmail.com>, GPLv3
4+
5+
[ "$TRACE_MODE" != "true" ] || set -x
6+
7+
printf "System:\n"
8+
DEVICE=$(getprop ro.product.model)
9+
printf "* device: $DEVICE\n"
10+
ANDROID=$(getprop ro.build.version.release)
11+
printf "* android: $ANDROID\n"
12+
ARCH=$(uname -m)
13+
printf "* architecture: $ARCH\n"
14+
if test -d /system/addon.d
15+
then
16+
printf "* addon.d: supported\n"
17+
else
18+
printf "* addon.d: unsupported\n"
19+
fi
20+
21+
printf "\nLatest BusyBox:\n"
22+
BB_BIN=$(which busybox.so)
23+
BB_VERSION=$($BB_BIN| head -1 | awk '{print $2}')
24+
printf "* version: $BB_VERSION\n"
25+
BB_APPLETS=$($BB_BIN --list | wc -l)
26+
printf "* applets: $BB_APPLETS items\n"
27+
BB_SIZE=$(stat -c '%s' "$BB_BIN")
28+
printf "* size: $BB_SIZE bytes\n"
29+
BB_MD5=$(md5sum "$BB_BIN" | awk '{print $1}')
30+
printf "* md5: $BB_MD5\n"
31+
if test -e "$(which ssl_helper.so)"
32+
then
33+
printf "* ssl_helper: yes\n"
34+
else
35+
printf "* ssl_helper: no\n"
36+
fi
37+
38+
printf "\nInstalled BusyBox:\n"
39+
if test -e "$INSTALL_DIR/busybox"
40+
then
41+
BB_PATH="$INSTALL_DIR"
42+
elif test -e "/system/bin/busybox"
43+
then
44+
BB_PATH="/system/bin"
45+
elif test -e "/system/xbin/busybox"
46+
then
47+
BB_PATH="/system/xbin"
48+
fi
49+
BB_BIN="$BB_PATH/busybox"
50+
if test -e "$BB_BIN"
51+
then
52+
printf "* location: $BB_PATH\n"
53+
BB_VERSION=$("$BB_BIN" | head -1 | awk '{print $2}')
54+
printf "* version: $BB_VERSION\n"
55+
BB_APPLETS=$("$BB_BIN" --list | wc -l)
56+
printf "* applets: $BB_APPLETS items\n"
57+
BB_SIZE=$(stat -c '%s' "$BB_BIN")
58+
printf "* size: $BB_SIZE bytes\n"
59+
BB_MD5=$(md5sum "$BB_BIN" | awk '{print $1}')
60+
printf "* md5: $BB_MD5\n"
61+
if test -e "$BB_PATH/ssl_helper"
62+
then
63+
printf "* ssl_helper: yes\n"
64+
else
65+
printf "* ssl_helper: no\n"
66+
fi
67+
if test -d /system/addon.d
68+
then
69+
if test -f /system/addon.d/99-busybox.sh
70+
then
71+
printf "* addon.d: yes\n"
72+
else
73+
printf "* addon.d: no\n"
74+
fi
75+
fi
76+
else
77+
printf "* not installed\n"
78+
fi

app/src/main/_libs/all/install.sh

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/system/bin/sh
2+
# BusyBox installer
3+
# (c) 2015-2022 Anton Skshidlevsky <meefik@gmail.com>, GPLv3
4+
5+
[ "$TRACE_MODE" != "true" ] || set -x
6+
7+
echo "### BEGIN INSTALL"
8+
echo
9+
10+
IS_SYSTEM_DIR=$(printf "$INSTALL_DIR" | grep -c "^/system/")
11+
12+
if test "$MOUNT_RAMDISK" = "true"
13+
then
14+
IS_RAM=$(grep -c "^tmpfs $INSTALL_DIR" /proc/mounts)
15+
if test "$IS_RAM" -eq 0
16+
then
17+
printf "Mounting $INSTALL_DIR as tmpfs ... "
18+
mount -o size=50M -t tmpfs tmpfs "$INSTALL_DIR"
19+
if test $? -eq 0
20+
then
21+
printf "done\n"
22+
else
23+
printf "fail\n"
24+
fi
25+
fi
26+
elif test "$IS_SYSTEM_DIR" -gt 0
27+
then
28+
printf "Remounting /system to rw ... "
29+
mount -o rw,remount /system 2>/dev/null || mount -o rw,remount / 2>/dev/null
30+
if test $? -eq 0
31+
then
32+
printf "done\n"
33+
else
34+
printf "fail\n"
35+
fi
36+
fi
37+
38+
for fn in busybox ssl_helper
39+
do
40+
printf "Copying $fn to $INSTALL_DIR ... "
41+
SOURCE_BIN=$(which $fn.so)
42+
if test -e "$INSTALL_DIR/$fn"
43+
then
44+
rm "$INSTALL_DIR/$fn"
45+
fi
46+
cp "$SOURCE_BIN" "$INSTALL_DIR/$fn"
47+
if test $? -eq 0
48+
then
49+
printf "done\n"
50+
else
51+
printf "fail\n"
52+
fi
53+
54+
printf "Changing permissions for $fn ... "
55+
chown 0:0 "$INSTALL_DIR/$fn"
56+
chmod 755 "$INSTALL_DIR/$fn"
57+
if test $? -eq 0
58+
then
59+
printf "done\n"
60+
else
61+
printf "fail\n"
62+
fi
63+
done
64+
65+
if test "$REPLACE_APPLETS" = "true"
66+
then
67+
printf "Removing old applets ... "
68+
#busybox.so --list | xargs -I APPLET rm $INSTALL_DIR/APPLET
69+
busybox.so --list | grep -v busybox | while read fn
70+
do
71+
if test -e "$INSTALL_DIR/$fn" -o -L "$INSTALL_DIR/$fn"
72+
then
73+
rm "$INSTALL_DIR/$fn"
74+
fi
75+
done
76+
if test $? -eq 0
77+
then
78+
printf "done\n"
79+
else
80+
printf "fail\n"
81+
fi
82+
fi
83+
84+
if test "$INSTALL_APPLETS" = "true"
85+
then
86+
printf "Installing new applets ... "
87+
"$INSTALL_DIR/busybox" --install -s "$INSTALL_DIR"
88+
if test $? -eq 0
89+
then
90+
printf "done\n"
91+
else
92+
printf "fail\n"
93+
fi
94+
fi
95+
96+
if test "$IS_SYSTEM_DIR" -gt 0 -a -d /system/addon.d -a "$MOUNT_RAMDISK" != "true"
97+
then
98+
printf "Installing addon.d script ... "
99+
echo "$INSTALL_DIR" > /system/addon.d/busybox-install-dir
100+
chmod 644 /system/addon.d/busybox-install-dir
101+
cp $(which addon_d.so) /system/addon.d/99-busybox.sh
102+
chown 0:0 /system/addon.d/99-busybox.sh
103+
chmod 755 /system/addon.d/99-busybox.sh
104+
if test $? -eq 0
105+
then
106+
printf "done\n"
107+
else
108+
printf "fail\n"
109+
fi
110+
fi
111+
112+
echo
113+
echo "### END INSTALL"

0 commit comments

Comments
 (0)