Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions Superuser/assets/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ echo -n -e 'ui_print\n' > /proc/self/fd/$2
ARCH=$(uname -m)

# x86 needs to match: i486, i686, x86_64, ...
if echo "$ARCH" | grep -q 86; then
PLATFORM=x86
elif [ "$ARCH" = "mips" -o "$ARCH" = "mips64" ]; then
PLATFORM=mips
else
PLATFORM=armeabi
fi
case "${ARCH}" in
(*86*)
PLATFORM=x86
;;
(arm|armel|armeabi|aarch64|arm64-v8a)
PLATFORM=armeabi
;;
(mips|mips64)
PLATFORM=mips
;;
esac

cd /tmp
mkdir superuser
Expand Down Expand Up @@ -45,8 +49,20 @@ cp $PLATFORM/su /system/xbin/su
chown 0:0 /system/xbin/su
chmod 0755 /system/xbin/su

cp Superuser.apk /system/app
chmod 644 /system/app/Superuser.apk
if test '/system/app/*/*.apk' != /system/app/*/*.apk 2>/dev/null
then
mkdir -m 755 -p /system/app/Superuser
cp Superuser.apk /system/app/Superuser
chmod 644 /system/app/Superuser/Superuser.apk
#elif test '/system/app/*.apk' != /system/app/*.apk 2>/dev/null
#then
else
cp Superuser.apk /system/app
chmod 644 /system/app/Superuser.apk
#else
# echo -n -e 'ui_print Install location for Superuser.apk unknown, failed\n' > /proc/self/fd/$2
# exit 1
fi

# if the system is at least 4.3, and there is no su daemon built in,
# let's try to install it using install-recovery.sh
Expand Down Expand Up @@ -75,6 +91,7 @@ for i in etc/install-recovery.sh bin/install-recovery.sh bin/install_recovery.sh
done

#Rename original app_process32
#TODO: add support for adding a hook into app_process64
if [ ! -f /system/bin/app_process32.old ];then
mv /system/bin/app_process32 /system/bin/app_process32.old
fi
Expand Down
2 changes: 1 addition & 1 deletion Superuser/build-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pushd "$tmpdir"
mkdir -p META-INF/com/google/android
cp "$ORIG"/assets/update-binary META-INF/com/google/android/update-binary
cp "$ORIG"/assets/install-recovery.sh .
cp -R "$ORIG"/libs/{x86,mips,armeabi} .
cp -R "$ORIG"/libs/{x86,x86_64,armeabi,arm64-v8a,mips,mips64} .

zip -r "$ORIG"/update-su.zip *
popd
Expand Down
4 changes: 2 additions & 2 deletions Superuser/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
APP_ABI := x86 armeabi mips
APP_ABI := x86 x86_64 armeabi arm64-v8a mips mips64
# NDK_TOOLCHAIN_VERSION=4.8
APP_PIE = true
APP_PIE = true