mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
CommonInstaller: update for APEX changes in Android 11
CommonPatcher: update for APEX changes in Android11 * patcher is not yet compatible with Android 11
This commit is contained in:
parent
1a1ae9f609
commit
343d2bddc4
@ -99,6 +99,8 @@ error () {
|
||||
nanodroid_storelogs
|
||||
fi
|
||||
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -220,7 +222,6 @@ is_mounted () {
|
||||
|
||||
mount_partitions () {
|
||||
if ${BOOTMODE}; then
|
||||
APEX_LD=/apex/com.android.runtime
|
||||
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
||||
else
|
||||
DEVICE_AB=FALSE
|
||||
@ -277,6 +278,11 @@ mount_partitions () {
|
||||
ln -sf /system/vendor /vendor >/dev/null
|
||||
fi
|
||||
|
||||
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
||||
|
||||
[ -d /system/apex ] && mount_apex
|
||||
fi
|
||||
|
||||
echo " "
|
||||
mount | sed -e '/magisk/d' | awk '{print $1 " on " $3 " params: " $6}'
|
||||
echo " "
|
||||
@ -284,13 +290,14 @@ mount_partitions () {
|
||||
echo " INFO: #8 [prop]"
|
||||
ls -l /system/*.prop
|
||||
|
||||
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
||||
echo " INFO: #9 [build_props] ${build_props}"
|
||||
|
||||
[ -z "${build_props}" ] && error "failed to mount /system (unsupported A/B device?)"
|
||||
|
||||
[ -d /system/apex ] && mount_apex
|
||||
fi
|
||||
[ -d /apex/com.android.art ] && export ANDROID_ART_ROOT=/apex/com.android.art
|
||||
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
||||
|
||||
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
||||
export ANDROID_I18N_ROOT /apex/com.android.i18n
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
@ -299,8 +306,6 @@ mount_partitions () {
|
||||
##########################################################################################
|
||||
|
||||
mount_apex () {
|
||||
APEX_LD=/apex/com.android.runtime
|
||||
|
||||
mkdir -p /apex
|
||||
|
||||
for apex in /system/apex/*; do
|
||||
@ -309,6 +314,8 @@ mount_apex () {
|
||||
|
||||
[ "${apex_mount}" == /apex/com.android.runtime.release ] && apex_mount=/apex/com.android.runtime
|
||||
[ "${apex_mount}" == /apex/com.android.runtime.debug ] && apex_mount=/apex/com.android.runtime
|
||||
[ "${apex_mount}" == /apex/com.android.art.release ] && apex_mount=/apex/com.android.art
|
||||
[ "${apex_mount}" == /apex/com.android.art.debug ] && apex_mount=/apex/com.android.art
|
||||
|
||||
mkdir -p "${apex_mount}"
|
||||
|
||||
@ -320,11 +327,7 @@ mount_apex () {
|
||||
fi
|
||||
done
|
||||
|
||||
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
||||
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
||||
|
||||
echo " INFO: #10 [APEX_LD] ${APEX_LD}"
|
||||
echo " INFO: #11 [APEX [ALL]] $(ls /system/apex/*)"
|
||||
echo " INFO: #10 [APEX [ALL]] $(ls /system/apex/*)"
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
@ -370,11 +373,8 @@ umount_partitions () {
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
mount | awk '/ \/apex/{print $1 " " $3}' | while read apex_loop apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
|
@ -11,7 +11,6 @@ MAGISKBASE=/data/adb
|
||||
MODID=NanoDroid_Patcher
|
||||
|
||||
TMPDIR=/dev/tmp/install
|
||||
APEX_LD=/system
|
||||
|
||||
PATCHER_ADDOND_DATA=/system/addon.d/nanodroid_patcher
|
||||
|
||||
@ -71,16 +70,21 @@ mount_apex_loop () {
|
||||
|
||||
# taken from Magisk, with modifications for NanoDroid
|
||||
mount_apex () {
|
||||
APEX_LD=/apex/com.android.runtime
|
||||
|
||||
mkdir -p /apex
|
||||
|
||||
APEX_LD=""
|
||||
|
||||
for apex in /system/apex/*; do
|
||||
apex_mount="/apex/$(basename ${apex} .apex)"
|
||||
apex_loop="/dev/loop_apex_$(basename ${apex} .apex)"
|
||||
|
||||
[ "${apex_mount}" == /apex/com.android.runtime.release ] && apex_mount=/apex/com.android.runtime
|
||||
[ "${apex_mount}" == /apex/com.android.runtime.debug ] && apex_mount=/apex/com.android.runtime
|
||||
[ "${apex_mount}" == /apex/com.android.art.release ] && apex_mount=/apex/com.android.art
|
||||
[ "${apex_mount}" == /apex/com.android.art.debug ] && apex_mount=/apex/com.android.art
|
||||
|
||||
APEX_LD="${apex_mount}/lib:${APEX_LD}"
|
||||
APEX_LD_64="${apex_mount}/lib64:${APEX_LD_64}"
|
||||
|
||||
mkdir -p "${apex_mount}"
|
||||
|
||||
@ -92,17 +96,12 @@ mount_apex () {
|
||||
fi
|
||||
done
|
||||
|
||||
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
||||
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
||||
|
||||
echo " INFO: #10 [APEX_LD] ${APEX_LD}"
|
||||
echo " INFO: #11 [APEX [ALL]] $(ls /system/apex/*)"
|
||||
echo " INFO: #10 [APEX [ALL]] $(ls /system/apex/*)"
|
||||
}
|
||||
|
||||
# taken from Magisk, with minor modifications for NanoDroid
|
||||
mount_partitions () {
|
||||
if ${BOOTMODE}; then
|
||||
APEX_LD=/apex/com.android.runtime
|
||||
build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
||||
else
|
||||
DEVICE_AB=FALSE
|
||||
@ -173,6 +172,12 @@ mount_partitions () {
|
||||
|
||||
[ -d /system/apex ] && mount_apex
|
||||
fi
|
||||
|
||||
[ -d /apex/com.android.art ] && export ANDROID_ART_ROOT=/apex/com.android.art
|
||||
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
||||
|
||||
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
||||
export ANDROID_I18N_ROOT /apex/com.android.i18n
|
||||
}
|
||||
|
||||
umount_partitions () {
|
||||
@ -181,15 +186,13 @@ umount_partitions () {
|
||||
umount -l /vendor 2>/dev/null
|
||||
umount -l /dev/random 2>/dev/null
|
||||
|
||||
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
||||
mount | awk '/ \/apex/{print $1 " " $3}' | while read apex_loop apex_mount; do
|
||||
umount -l "${apex_mount}" 2>/dev/null
|
||||
done
|
||||
|
||||
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
||||
losetup -d "${apex_loop}" 2>/dev/null
|
||||
done
|
||||
|
||||
unset ANDROID_RUNTIME_ROOT
|
||||
unset ANDROID_ART_ROOT
|
||||
unset ANDROID_TZDATA_ROOT
|
||||
unset BOOTCLASSPATH
|
||||
|
||||
@ -201,6 +204,8 @@ error () {
|
||||
ui_print " !! ${@}"
|
||||
ui_print " "
|
||||
|
||||
${BOOTMODE} || umount_partitions
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -341,37 +346,26 @@ detect_arch () {
|
||||
|
||||
export PATH="${BASEDIR}/busybox:/system/bin:/system/xbin"
|
||||
|
||||
DALVIKVM_BIN=$(ls -l ${APEX_LD}/bin/dalvikvm | awk '{print $NF}')
|
||||
DALVIKVM_ARCH=$("${FILE}" -m "${BASEDIR}/magic.mgc" -L ${APEX_LD}/bin/dalvikvm)
|
||||
DALVIKVM_ARCH=$("${FILE}" -m "${BASEDIR}/magic.mgc" -L /system/bin/dalvikvm)
|
||||
|
||||
case ${DALVIKVM_BIN} in
|
||||
*dalvikvm32* )
|
||||
export LD_LIBRARY_PATH="${APEX_LD}/lib:/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib"
|
||||
;;
|
||||
|
||||
*dalvikvm64* )
|
||||
export LD_LIBRARY_PATH="${APEX_LD}/lib64:/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64"
|
||||
;;
|
||||
|
||||
*dalvikvm* )
|
||||
case ${DALVIKVM_ARCH} in
|
||||
*32-bit* )
|
||||
export LD_LIBRARY_PATH="${APEX_LD}/lib:/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib"
|
||||
export LD_LIBRARY_PATH="/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib:${APEX_LD}"
|
||||
;;
|
||||
|
||||
*64-bit* )
|
||||
export LD_LIBRARY_PATH="${APEX_LD}/lib64:/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64"
|
||||
;;
|
||||
esac
|
||||
export LD_LIBRARY_PATH="/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64:${APEX_LD_64}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f ${APEX_LD}/etc/ld.config.txt ]; then
|
||||
export LD_CONFIG_FILE="${APEX_LD}/etc/ld.config.txt"
|
||||
elif [ -f ${APEX_LD}/etc/ld.config.${SDK_VERSION}.txt ]; then
|
||||
export LD_CONFIG_FILE="${APEX_LD}/etc/ld.config.${SDK_VERSION}.txt"
|
||||
if [ -f ${ANDROID_RUNTIME_ROOT}/etc/ld.config.txt ]; then
|
||||
export LD_CONFIG_FILE="${ANDROID_RUNTIME_ROOT}/etc/ld.config.txt"
|
||||
elif [ -f ${ANDROID_RUNTIME_ROOT}/etc/ld.config.${SDK_VERSION}.txt ]; then
|
||||
export LD_CONFIG_FILE="${ANDROID_RUNTIME_ROOT}/etc/ld.config.${SDK_VERSION}.txt"
|
||||
fi
|
||||
|
||||
unset LD_PRELOAD
|
||||
|
||||
echo " *** LD_CONFIG_FILE=${LD_CONFIG_FILE}"
|
||||
ui_print " > device architecture: ${ARCH}"
|
||||
}
|
||||
@ -499,7 +493,7 @@ call_dalvikvm () {
|
||||
export BOOTCLASSPATH=${ND_BOOTCLASSPATH}
|
||||
fi
|
||||
|
||||
supported_opts=$(${APEX_LD}/bin/dalvikvm --help 2>&1)
|
||||
supported_opts=$(/system/bin/dalvikvm --help 2>&1)
|
||||
|
||||
[[ "${supported_opts}" == *\[no\]image-dex2oat* ]] && DALVIKVM_OPTS="${DALVIKVM_OPTS} -Xnoimage-dex2oat"
|
||||
[[ "${supported_opts}" == *verbose:*gc* ]] && DALVIKVM_OPTS="${DALVIKVM_OPTS} -verbose:gc"
|
||||
@ -511,7 +505,7 @@ call_dalvikvm () {
|
||||
echo " *** DALVIKVM_OPTS=${DALVIKVM_OPTS}"
|
||||
fi
|
||||
|
||||
${APEX_LD}/bin/dalvikvm -Xnoimage-dex2oat ${DALVIKVM_OPTS} "${@}"
|
||||
/system/bin/dalvikvm -Xnoimage-dex2oat ${DALVIKVM_OPTS} "${@}"
|
||||
}
|
||||
|
||||
deodex_vdex () {
|
||||
|
Loading…
Reference in New Issue
Block a user