2018-03-20 17:52:53 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
##########################################################################################
|
2020-12-29 09:26:08 +00:00
|
|
|
#
|
2020-08-13 06:50:52 +00:00
|
|
|
# NanoDroid Patcher (Haystack Frontend)
|
2018-03-20 17:52:53 +00:00
|
|
|
# by Nanolx
|
|
|
|
#
|
|
|
|
##########################################################################################
|
|
|
|
|
2021-01-16 08:24:41 +00:00
|
|
|
VERSION=23.1.1.20210116
|
2020-08-24 19:46:38 +00:00
|
|
|
MAGISKBASE=/data/adb
|
2020-08-28 20:32:18 +00:00
|
|
|
MODID=NanoDroid_Patcher
|
2019-06-09 20:12:18 +00:00
|
|
|
|
2020-10-09 18:19:26 +00:00
|
|
|
TMPDIR=/dev/tmp/install
|
|
|
|
|
|
|
|
PATCHER_ADDOND_DATA=/system/addon.d/nanodroid_patcher
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Generic Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
2019-06-09 20:12:18 +00:00
|
|
|
show_banner () {
|
|
|
|
ui_print " "
|
|
|
|
ui_print "********************************"
|
|
|
|
ui_print " NanoDroid "
|
|
|
|
ui_print " Framework Patcher "
|
|
|
|
ui_print " Powered by DexPatcher "
|
|
|
|
ui_print " ${VERSION} "
|
|
|
|
ui_print "********************************"
|
|
|
|
ui_print " "
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
ui_print() {
|
2019-06-09 20:12:18 +00:00
|
|
|
${BOOTMODE} && echo "${1}" || \
|
|
|
|
echo -e "ui_print ${1}\nui_print" >> /proc/self/fd/${OUTFD}
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
is_mounted () {
|
2020-10-18 07:39:48 +00:00
|
|
|
grep -q " $(readlink -f ${1}) " /proc/mounts 2>/dev/null
|
2018-03-20 17:52:53 +00:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex_loop () {
|
|
|
|
local number=0
|
|
|
|
local minorx=1
|
|
|
|
local loop
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
[ -e /dev/block/loop1 ] && minorx=$(stat -Lc '%T' /dev/block/loop1)
|
|
|
|
|
|
|
|
apex_mount="${1}"
|
|
|
|
|
|
|
|
while [ ${number} -lt 64 ]; do
|
|
|
|
loop=/dev/block/loop${number}
|
|
|
|
[ -e ${loop} ] || mknod ${loop} b 7 $((number * minorx))
|
|
|
|
|
2020-08-15 17:55:00 +00:00
|
|
|
if losetup "${loop}" /apex/apex_payload.img 2>/dev/null; then
|
2020-08-11 19:25:48 +00:00
|
|
|
if mount -text4 -oro,noatime "${loop}" "${apex_mount}"; then
|
|
|
|
rm -f /apex/apex_payload.img
|
|
|
|
break
|
|
|
|
fi
|
2019-10-12 18:00:52 +00:00
|
|
|
fi
|
2020-08-11 19:25:48 +00:00
|
|
|
|
|
|
|
number=$((number + 1))
|
2019-10-12 18:00:52 +00:00
|
|
|
done
|
2020-08-11 19:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex () {
|
2020-08-24 20:10:54 +00:00
|
|
|
mkdir -p /apex
|
2019-10-08 18:46:47 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
APEX_LD=""
|
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
for apex in /system/apex/*; do
|
|
|
|
apex_mount="/apex/$(basename ${apex} .apex)"
|
|
|
|
apex_loop="/dev/loop_apex_$(basename ${apex} .apex)"
|
2019-10-08 18:46:47 +00:00
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
[ "${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
|
2020-10-17 18:23:32 +00:00
|
|
|
[ "${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}"
|
2020-04-17 18:45:32 +00:00
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
mkdir -p "${apex_mount}"
|
2020-08-18 08:42:51 +00:00
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
if [ -f "${apex}" ]; then
|
|
|
|
unzip -oq "${apex}" apex_payload.img -d /apex
|
|
|
|
mount_apex_loop "${apex_mount}" || error "APEX loop setup failed!"
|
|
|
|
elif [ -d "${apex}" ]; then
|
|
|
|
mount -o bind "${apex}" "${apex_mount}"
|
|
|
|
fi
|
|
|
|
done
|
2020-04-17 18:45:32 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
echo " INFO: #10 [APEX [ALL]] $(ls /system/apex/*)"
|
2019-10-23 19:33:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# taken from Magisk, with minor modifications for NanoDroid
|
2021-01-12 20:53:59 +00:00
|
|
|
toupper() {
|
|
|
|
echo "$@" | tr '[:lower:]' '[:upper:]'
|
|
|
|
}
|
|
|
|
|
2020-10-20 19:02:03 +00:00
|
|
|
find_block () {
|
2021-01-12 20:53:59 +00:00
|
|
|
local block tmp partname devname device
|
|
|
|
|
|
|
|
block=${1}${SLOT}
|
|
|
|
device=$(find /dev/block \( -type b -o -type c -o -type l \) -name ${block} | head -n 1)
|
|
|
|
|
|
|
|
if [ ! -z ${device} ]; then
|
|
|
|
readlink -f ${device}
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for uevent in /sys/dev/block/*/uevent; do
|
|
|
|
partname=$(awk -F= '/PARTNAME/{print $2}' ${uevent})
|
|
|
|
devname=$(awk -F= '/DEVNAME/{print $2}' ${uevent})
|
|
|
|
if [ "$(toupper ${block})" = "$(toupper ${partname})" ]; then
|
|
|
|
echo /dev/block/${devname}
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
device=$(find /dev \( -type b -o -type c -o -type l \) -maxdepth 1 -iname ${block} | head -n 1)
|
|
|
|
if [ ! -z ${device} ]; then
|
|
|
|
readlink -f ${device}
|
|
|
|
return 0
|
2020-10-20 19:02:03 +00:00
|
|
|
fi
|
2021-01-12 20:53:59 +00:00
|
|
|
|
|
|
|
return 1
|
|
|
|
|
2020-10-20 19:02:03 +00:00
|
|
|
}
|
|
|
|
|
2019-10-23 19:33:46 +00:00
|
|
|
mount_partitions () {
|
2020-10-17 19:39:41 +00:00
|
|
|
if ! ${BOOTMODE}; then
|
2020-08-24 20:10:54 +00:00
|
|
|
VENDOR_COMPAT=FALSE
|
|
|
|
SYSTEM_AS_ROOT=FALSE
|
|
|
|
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
|
|
|
if [ -z ${SLOT} ]; then
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot)
|
2021-01-12 20:53:59 +00:00
|
|
|
[ -z ${SLOT} ] || SLOT=_${SLOT}
|
2019-10-23 19:33:46 +00:00
|
|
|
fi
|
2021-01-12 20:53:59 +00:00
|
|
|
[ -z ${SLOT} ] && DEVICE_AB=FALSE || DEVICE_AB=TRUE
|
|
|
|
decho " INFO: #1 [SLOT] ${SLOT}"
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2021-01-12 20:53:59 +00:00
|
|
|
is_mounted /data || mount /data || decho "failed to mount /data!"
|
2020-10-20 16:45:09 +00:00
|
|
|
|
|
|
|
mount -o bind /dev/urandom /dev/random
|
|
|
|
|
2020-10-20 19:02:03 +00:00
|
|
|
SYSTEM_BLOCK=$(find_block system)
|
2021-01-12 20:53:59 +00:00
|
|
|
decho " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
|
|
|
|
|
|
|
if is_mounted /system_root; then
|
|
|
|
umount /system 2&>/dev/null
|
|
|
|
umount /system_root 2&>/dev/null
|
|
|
|
fi
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-10-20 19:02:03 +00:00
|
|
|
mkdir -p /system /system_root
|
|
|
|
mount -o rw ${SYSTEM_BLOCK} /system
|
|
|
|
|
|
|
|
if [ -f /system/build.prop ]; then
|
|
|
|
SYSTEM=/system
|
|
|
|
elif [ -f /system/system/build.prop -o -f /system/init -o -L /system/init ]; then
|
|
|
|
SYSTEM_AS_ROOT=true
|
|
|
|
SYSTEM=/system/system
|
|
|
|
if ! mount --move /system /system_root; then
|
|
|
|
umount /system
|
|
|
|
umount -l /system
|
2021-01-12 20:53:59 +00:00
|
|
|
mount -o rw ${SYSTEM_BLOCK} /system_root
|
2020-10-05 17:56:26 +00:00
|
|
|
fi
|
2020-10-20 19:02:03 +00:00
|
|
|
mount -o bind /system_root/system /system
|
2020-08-24 20:10:54 +00:00
|
|
|
fi
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-10-20 19:02:03 +00:00
|
|
|
VENDOR_BLOCK=$(find_block vendor)
|
2020-08-24 20:10:54 +00:00
|
|
|
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
2019-10-08 18:46:47 +00:00
|
|
|
|
2020-09-30 19:21:41 +00:00
|
|
|
! is_mounted /vendor && mount -o ro /vendor
|
2020-10-05 17:56:26 +00:00
|
|
|
! is_mounted /vendor && mount -o ro ${VENDOR_BLOCK} /vendor
|
2019-10-29 18:38:30 +00:00
|
|
|
|
2020-10-02 17:40:46 +00:00
|
|
|
if [[ ! $(is_mounted /vendor) && -d /system/vendor ]]; then
|
2020-09-30 19:21:41 +00:00
|
|
|
### XXX work-around required for some devices
|
2020-08-24 20:10:54 +00:00
|
|
|
VENDOR_COMPAT=TRUE
|
|
|
|
ln -sf /system/vendor /vendor >/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo " "
|
|
|
|
mount | sed -e '/magisk/d' | awk '{print $1 " on " $3 " params: " $6}'
|
|
|
|
echo " "
|
2019-10-23 19:33:46 +00:00
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
echo " INFO: #8 [prop]"
|
|
|
|
ls -l /system/*.prop
|
2018-08-27 19:25:03 +00:00
|
|
|
|
2020-08-24 20:10:54 +00:00
|
|
|
[ -d /system/apex ] && mount_apex
|
|
|
|
fi
|
2020-10-17 18:23:32 +00:00
|
|
|
|
2020-10-20 16:45:09 +00:00
|
|
|
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
|
2020-10-17 19:39:41 +00:00
|
|
|
|
|
|
|
if [ -d /apex/com.android.art ]; then
|
|
|
|
export ANDROID_ART_ROOT=/apex/com.android.art
|
|
|
|
export ANDROID_RUNTIME_ROOT=${ANDROID_ART_ROOT}
|
|
|
|
elif [ -d /apex/com.android.runtime ]; then
|
|
|
|
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
|
|
|
fi
|
2020-10-17 18:23:32 +00:00
|
|
|
|
|
|
|
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
2020-10-17 20:01:14 +00:00
|
|
|
export ANDROID_I18N_ROOT=/apex/com.android.i18n
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
umount_partitions () {
|
|
|
|
umount -l /system_root 2>/dev/null
|
|
|
|
umount -l /system 2>/dev/null
|
|
|
|
umount -l /vendor 2>/dev/null
|
|
|
|
umount -l /dev/random 2>/dev/null
|
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
mount | awk '/ \/apex/{print $1 " " $3}' | while read apex_loop apex_mount; do
|
2020-08-11 19:25:48 +00:00
|
|
|
umount -l "${apex_mount}" 2>/dev/null
|
|
|
|
losetup -d "${apex_loop}" 2>/dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
unset ANDROID_RUNTIME_ROOT
|
2020-10-17 18:23:32 +00:00
|
|
|
unset ANDROID_ART_ROOT
|
2020-08-11 19:25:48 +00:00
|
|
|
unset ANDROID_TZDATA_ROOT
|
|
|
|
unset BOOTCLASSPATH
|
|
|
|
|
|
|
|
rm -rf /apex
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
error () {
|
2018-09-06 18:27:19 +00:00
|
|
|
ui_print " "
|
|
|
|
ui_print " !! ${@}"
|
|
|
|
ui_print " "
|
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
${BOOTMODE} || umount_partitions
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2019-04-20 11:08:07 +00:00
|
|
|
set_perm () {
|
|
|
|
chown ${2}:${3} ${1} || error "failed change owner for ${1}"
|
|
|
|
chmod ${4} ${1} || error "failed to change mode for ${1}"
|
|
|
|
|
2020-10-04 16:22:13 +00:00
|
|
|
if [ -n "${5}" ]; then
|
2019-04-20 11:08:07 +00:00
|
|
|
chcon ${5} ${1} 2>/dev/null
|
|
|
|
else chcon 'u:object_r:system_file:s0' ${1} 2>/dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_recursive() {
|
|
|
|
find ${1} -type d 2>/dev/null | while read dir; do
|
|
|
|
set_perm ${dir} ${2} ${3} ${4} ${6}
|
|
|
|
done
|
|
|
|
find ${1} -type f 2>/dev/null | while read file; do
|
|
|
|
set_perm ${file} ${2} ${3} ${5} ${6}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_data () {
|
|
|
|
if [ "${1}" = "-r" ]; then
|
|
|
|
echo " perm: data [recursive] {${2}}"
|
|
|
|
set_perm_recursive ${2} 0 0 0755 0644
|
|
|
|
else
|
|
|
|
echo " perm: data [single] {${1}}"
|
|
|
|
set_perm ${1} 0 0 0644
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Device Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
detect_outfd () {
|
2018-09-08 18:02:24 +00:00
|
|
|
if [ -z $OUTFD ] || readlink /proc/$$/fd/$OUTFD | grep -q /tmp; then
|
|
|
|
# We will have to manually find out OUTFD
|
2018-03-20 17:52:53 +00:00
|
|
|
for FD in `ls /proc/$$/fd`; do
|
2018-09-08 18:02:24 +00:00
|
|
|
if readlink /proc/$$/fd/$FD | grep -q pipe; then
|
|
|
|
if ps | grep -v grep | grep -q " 3 $FD "; then
|
2018-03-20 17:52:53 +00:00
|
|
|
OUTFD=$FD
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-08-24 17:18:31 +00:00
|
|
|
detect_mode () {
|
|
|
|
MODE=SYSTEM
|
2020-08-24 19:46:38 +00:00
|
|
|
[ -f /data/adb/magisk/util_functions.sh ] && MODE=MAGISK
|
2020-08-24 17:18:31 +00:00
|
|
|
|
2020-08-24 19:46:38 +00:00
|
|
|
ui_print " > installation mode: ${MODE}"
|
2020-08-24 17:18:31 +00:00
|
|
|
ui_print " "
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
detect_bootmode () {
|
2020-08-15 17:36:12 +00:00
|
|
|
[ -z $BOOTMODE ] && ps | grep zygote | grep -qv grep && BOOTMODE=true
|
|
|
|
[ -z $BOOTMODE ] && ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true
|
|
|
|
[ -z $BOOTMODE ] && BOOTMODE=false
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
grep_prop() {
|
2020-10-20 16:45:09 +00:00
|
|
|
sed -n "s/^${1}=//p" /system/build.prop ${2} | head -n 1
|
2018-08-05 11:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
grep_cmdline() {
|
|
|
|
local REGEX="s/^${1}=//p"
|
|
|
|
sed -E 's/ +/\n/g' /proc/cmdline | \
|
|
|
|
sed -n "${REGEX}" 2>/dev/null
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
2018-08-26 19:07:23 +00:00
|
|
|
detect_odex () {
|
2018-08-27 18:04:25 +00:00
|
|
|
SERVICES_JAR_DEX=$(unzip -lq /system/framework/services.jar | grep classes.dex)
|
|
|
|
|
2018-08-27 19:46:52 +00:00
|
|
|
if [ -n "$(find '/system/framework/' -name 'services.vdex')" ]; then
|
2018-08-27 19:41:36 +00:00
|
|
|
ROM_DEX_STATUS=VDEX
|
2018-08-27 19:46:52 +00:00
|
|
|
elif [ -n "$(find '/system/framework/' -name 'services.odex')" ]; then
|
2018-08-27 19:41:36 +00:00
|
|
|
ROM_DEX_STATUS=ODEX
|
2018-08-27 19:51:18 +00:00
|
|
|
else ROM_DEX_STATUS=UNKOWN
|
2018-08-24 19:24:01 +00:00
|
|
|
fi
|
2018-08-26 19:08:04 +00:00
|
|
|
|
2018-08-27 19:41:36 +00:00
|
|
|
[ "${SERVICES_JAR_DEX}" ] && ROM_DEX_STATUS=DEODEX
|
|
|
|
|
2018-08-27 19:51:18 +00:00
|
|
|
ui_print " "
|
|
|
|
ui_print " ++"
|
|
|
|
ui_print " ++ services.jar status: ${ROM_DEX_STATUS}"
|
|
|
|
ui_print " ++"
|
2018-09-06 18:44:11 +00:00
|
|
|
|
|
|
|
[ "${SDK_VERSION}" -gt 27 -a "${ROM_DEX_STATUS}" != "DEODEX" ] && \
|
2020-04-15 18:35:15 +00:00
|
|
|
error "Android 9 or newer is only supported on de-odexed ROMs currently"
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
2020-12-29 09:26:08 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Setup Busybox
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
setup_busybox () {
|
2021-01-17 11:31:55 +00:00
|
|
|
case $(uname -m) in
|
2021-01-17 12:40:37 +00:00
|
|
|
arm* | aarch* ) local bb_arch=arm ;;
|
2021-01-17 11:31:55 +00:00
|
|
|
x86* ) local bb_arch=x86 ;;
|
|
|
|
* ) error "arch \"$(uname -m)\" is not supported"
|
|
|
|
esac
|
2020-12-29 09:26:08 +00:00
|
|
|
|
|
|
|
if [ -f ${TMPDIR}/busybox.${bb_arch} ]; then
|
|
|
|
BUSY=${TMPDIR}/busybox.${bb_arch}
|
|
|
|
else BUSY=${BASEDIR}/busybox.${bb_arch}
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod 0755 ${BUSY}
|
|
|
|
|
|
|
|
rm -rf ${BASEDIR}/busybox
|
|
|
|
mkdir -p ${BASEDIR}/busybox
|
|
|
|
|
|
|
|
ln -sf ${BUSY} ${BASEDIR}/busybox/busybox
|
|
|
|
${BUSY} --install -s ${BASEDIR}/busybox/
|
|
|
|
|
|
|
|
export PATH="${BASEDIR}/busybox:/system/bin:/system/xbin"
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
detect_arch () {
|
|
|
|
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
|
|
|
|
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
|
|
|
|
ABILONG=$(grep_prop ro.product.cpu.abi)
|
|
|
|
|
|
|
|
ARCH=arm
|
|
|
|
|
|
|
|
[ "$ABI" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABI2" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABILONG" = "arm64-v8a" ] && ARCH=arm64
|
|
|
|
[ "$ABILONG" = "x86_64" ] && ARCH=x86_64
|
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm | arm64 )
|
|
|
|
ZIPB=${BASEDIR}/zip.arm
|
2018-11-14 21:22:38 +00:00
|
|
|
FILE=${BASEDIR}/file.arm
|
2018-03-20 17:52:53 +00:00
|
|
|
;;
|
|
|
|
x86 | x86_64 )
|
|
|
|
ZIPB=${BASEDIR}/zip.x86
|
2018-11-14 21:22:38 +00:00
|
|
|
FILE=${BASEDIR}/file.x86
|
2018-03-20 17:52:53 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2019-04-25 18:43:45 +00:00
|
|
|
V_EX=${BASEDIR}/vdexExtractor.${ARCH}
|
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
DALVIKVM_ARCH=$("${FILE}" -m "${BASEDIR}/magic.mgc" -L /system/bin/dalvikvm)
|
2018-11-14 21:22:38 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
case ${DALVIKVM_ARCH} in
|
|
|
|
*32-bit* )
|
|
|
|
export LD_LIBRARY_PATH="/system/lib:/vendor/lib:/system/vendor/lib:/product/lib:/system/product/lib:${APEX_LD}"
|
2018-11-19 21:13:15 +00:00
|
|
|
;;
|
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
*64-bit* )
|
|
|
|
export LD_LIBRARY_PATH="/system/lib64:/vendor/lib64:/system/vendor/lib64:/product/lib64:/system/product/lib64:${APEX_LD_64}"
|
2018-11-14 21:22:38 +00:00
|
|
|
;;
|
2018-10-02 21:32:20 +00:00
|
|
|
esac
|
2018-08-26 13:04:23 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
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"
|
2020-08-17 16:40:58 +00:00
|
|
|
fi
|
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
unset LD_PRELOAD
|
|
|
|
|
2020-08-17 16:40:58 +00:00
|
|
|
echo " *** LD_CONFIG_FILE=${LD_CONFIG_FILE}"
|
2018-03-20 17:52:53 +00:00
|
|
|
ui_print " > device architecture: ${ARCH}"
|
|
|
|
}
|
|
|
|
|
|
|
|
detect_sdk () {
|
|
|
|
SDK_VERSION=$(grep_prop ro.build.version.sdk)
|
|
|
|
|
2020-11-03 09:45:40 +00:00
|
|
|
[ "${SDK_VERSION}" -gt 30 ] && \
|
|
|
|
error "Android versions beyond Android 11 are not yet supported"
|
2018-08-26 17:03:06 +00:00
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
[ "${SDK_VERSION}" -lt 16 ] && \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "Android versions before Jelly Bean are not supported"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2018-12-27 21:11:09 +00:00
|
|
|
if [ "${SDK_VERSION}" -gt 25 ]; then
|
|
|
|
BAKSMALI="${BASEDIR}/baksmali_26.dex"
|
|
|
|
SMALI="${BASEDIR}/smali_26.dex"
|
|
|
|
elif [ "${SDK_VERSION}" -gt 23 ]; then
|
2020-08-15 19:01:29 +00:00
|
|
|
BAKSMALI="${BASEDIR}/baksmali_24.dex"
|
|
|
|
SMALI="${BASEDIR}/smali_24.dex"
|
2018-12-27 21:11:09 +00:00
|
|
|
else
|
2020-08-15 19:01:29 +00:00
|
|
|
BAKSMALI="${BASEDIR}/baksmali_19.dex"
|
|
|
|
SMALI="${BASEDIR}/smali_19.dex"
|
2018-12-27 21:11:09 +00:00
|
|
|
fi
|
2018-08-27 16:53:57 +00:00
|
|
|
|
2020-08-15 17:36:39 +00:00
|
|
|
if [ "${SDK_VERSION}" -gt 25 ]; then
|
|
|
|
DEXPATCHER="${BASEDIR}/dexpatcher_26.dex"
|
|
|
|
else DEXPATCHER="${BASEDIR}/dexpatcher_19.dex"
|
|
|
|
fi
|
|
|
|
|
2018-09-19 16:42:34 +00:00
|
|
|
PATCH_CORE="${BASEDIR}/core_services.jar.dex"
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
if [ "${SDK_VERSION}" -lt 24 ]; then
|
|
|
|
ui_print " > Android 4.1 - 6.0 (SDK ${SDK_VERSION}) detected"
|
|
|
|
PATCH_HOOK="${BASEDIR}/hook_4.1-6.0_services.jar.dex"
|
|
|
|
else
|
2020-04-04 12:12:19 +00:00
|
|
|
ui_print " > Android 7.0 - 10.0 (SDK ${SDK_VERSION}) detected"
|
|
|
|
PATCH_HOOK="${BASEDIR}/hook_7.0-10.0_services.jar.dex"
|
2018-03-20 17:52:53 +00:00
|
|
|
fi
|
2020-08-15 17:43:15 +00:00
|
|
|
|
|
|
|
[ "${SDK_VERSION}" -gt 21 ] && DEX_OPTS="--multi-dex-threaded"
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
2018-12-27 21:11:09 +00:00
|
|
|
##########################################################################################
|
2020-08-24 19:46:38 +00:00
|
|
|
# check if ROM has native fake signature spoofing support
|
|
|
|
# origingally by @ale5000 - revised by me
|
2018-12-27 21:11:09 +00:00
|
|
|
##########################################################################################
|
|
|
|
|
2020-08-15 18:56:03 +00:00
|
|
|
check_fake_package_signature () {
|
2018-12-27 21:11:09 +00:00
|
|
|
PERMISSION=android.permission.FAKE_PACKAGE_SIGNATURE
|
|
|
|
PERMISSION_OD=$(echo -n "${PERMISSION}" | od -A n -t x1 | tr -d '\n' | sed -e 's/^ //g;s/ /00/g')
|
2020-09-28 17:07:14 +00:00
|
|
|
PATCH_TYPE=""
|
2020-08-24 19:46:38 +00:00
|
|
|
FRAMEWORKRES_PATCH=false
|
|
|
|
SERVICESJAR_PATCH=false
|
2018-12-27 21:11:09 +00:00
|
|
|
|
2020-08-24 17:19:18 +00:00
|
|
|
mkdir -p ${TMPDIR}/sigcheck
|
2019-03-09 21:16:47 +00:00
|
|
|
|
2020-08-24 19:46:38 +00:00
|
|
|
# natively patched ROM: only framework-res.apk patched (old)
|
|
|
|
# natively patched ROM: both framework-res.apk and services.jar patched (new)
|
|
|
|
# self patched ROM: only services.jar patched
|
|
|
|
|
|
|
|
# check framework-res.apk for the patch
|
2020-08-29 19:43:10 +00:00
|
|
|
unzip -oq /system/framework/framework-res.apk -d "${TMPDIR}/sigcheck" \
|
2020-08-24 17:19:18 +00:00
|
|
|
|| error "failed to unpack framework-res.apk"
|
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
grep -qF "${PERMISSION}" "${TMPDIR}"/sigcheck/AndroidManifest.xml && FRAMEWORKRES_PATCH=true
|
|
|
|
od -A n -t x1 "${TMPDIR}"/sigcheck/AndroidManifest.xml | tr -d ' \n' | grep -qF "${PERMISSION_OD}" && FRAMEWORKRES_PATCH=true
|
2020-08-24 19:46:38 +00:00
|
|
|
|
|
|
|
# check services.jar for the patch
|
2020-08-29 19:43:10 +00:00
|
|
|
unzip -oq /system/framework/services.jar -d "${TMPDIR}/sigcheck" \
|
2020-08-24 17:19:18 +00:00
|
|
|
|| error "failed to unpack services.jar"
|
2018-12-27 21:11:09 +00:00
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
grep -qF "${PERMISSION}" "${TMPDIR}"/sigcheck/*.dex && SERVICESJAR_PATCH=true
|
|
|
|
od -A n -t x1 "${TMPDIR}"/sigcheck/*.dex | tr -d ' \n' | grep -qF "${PERMISSION_OD}" && SERVICESJAR_PATCH=true
|
2020-08-24 19:46:38 +00:00
|
|
|
|
|
|
|
# we don't use this anywhere (except in SysTest log),
|
|
|
|
# but may still come in hand in the future
|
|
|
|
if ${FRAMEWORKRES_PATCH} && ! ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="native_old"
|
|
|
|
elif ${FRAMEWORKRES_PATCH} && ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="native_new"
|
|
|
|
elif ! ${FRAMEWORKRES_PATCH} && ${SERVICESJAR_PATCH}; then
|
|
|
|
PATCH_TYPE="self_patched"
|
|
|
|
fi
|
2018-12-27 21:11:09 +00:00
|
|
|
|
2020-09-28 17:07:14 +00:00
|
|
|
[ -n "${PATCH_TYPE}" ] && return 0 || return 1
|
2018-12-27 21:11:09 +00:00
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Patcher Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
setup_patcher () {
|
|
|
|
ui_print " > preparing environment"
|
|
|
|
|
|
|
|
rm -rf ${TMPDIR}
|
|
|
|
mkdir -p ${TMPDIR}
|
|
|
|
|
2019-04-25 18:49:26 +00:00
|
|
|
unzip -oq "${ZIP}" -d ${TMPDIR} || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "failed to prepare environment"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2020-10-25 18:57:38 +00:00
|
|
|
BASEDIR="${TMPDIR}/dexpatcher"
|
|
|
|
|
2018-09-08 18:16:54 +00:00
|
|
|
for bin in zip.arm zip.x86 \
|
2018-08-26 16:02:36 +00:00
|
|
|
vdexExtractor.arm vdexExtractor.x86 \
|
2018-11-19 17:26:45 +00:00
|
|
|
vdexExtractor.arm64 vdexExtractor.x86_64 \
|
2018-11-14 21:22:38 +00:00
|
|
|
file.arm file.x86; do
|
2018-03-20 17:52:53 +00:00
|
|
|
chmod 0755 "${BASEDIR}/${bin}" || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "failed to prepare environment"
|
2018-03-20 17:52:53 +00:00
|
|
|
done
|
2020-10-22 19:35:43 +00:00
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
2020-08-15 17:36:12 +00:00
|
|
|
call_dalvikvm () {
|
2020-08-18 16:42:11 +00:00
|
|
|
if [ -z "${ND_BOOTCLASSPATH}" ]; then
|
2020-08-15 17:36:12 +00:00
|
|
|
DALVIKVM_OPTS=""
|
|
|
|
|
2020-08-18 16:42:11 +00:00
|
|
|
if ! ${BOOTMODE}; then
|
|
|
|
for jar in /system/framework/*.jar; do
|
|
|
|
ND_BOOTCLASSPATH="${jar}:${ND_BOOTCLASSPATH}"
|
|
|
|
done
|
2020-08-15 20:14:22 +00:00
|
|
|
|
2020-08-18 16:42:11 +00:00
|
|
|
for jar in /apex/*/javalib/*.jar; do
|
|
|
|
ND_BOOTCLASSPATH="${jar}:${ND_BOOTCLASSPATH}"
|
|
|
|
done
|
2020-08-15 17:36:12 +00:00
|
|
|
|
2020-08-18 16:42:11 +00:00
|
|
|
export BOOTCLASSPATH=${ND_BOOTCLASSPATH}
|
|
|
|
fi
|
2020-08-15 17:36:12 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
supported_opts=$(/system/bin/dalvikvm --help 2>&1)
|
2020-08-15 17:36:12 +00:00
|
|
|
|
2021-01-17 14:28:42 +00:00
|
|
|
echo "${supported_opts}" | grep -q "\[no\]image-dex2oat" && DALVIKVM_OPTS="${DALVIKVM_OPTS} -Xnoimage-dex2oat"
|
|
|
|
echo "${supported_opts}" | grep -q "verbose:.*gc" && DALVIKVM_OPTS="${DALVIKVM_OPTS} -verbose:gc"
|
|
|
|
echo "${supported_opts}" | grep -q "verbose:.*jit" && DALVIKVM_OPTS="${DALVIKVM_OPTS} -verbose:jit"
|
|
|
|
echo "${supported_opts}" | grep -q "verbose:.*jni" && DALVIKVM_OPTS="${DALVIKVM_OPTS} -verbose:jni"
|
|
|
|
echo "${supported_opts}" | grep -q "verbose:.*class" && DALVIKVM_OPTS="${DALVIKVM_OPTS} -verbose:class"
|
2020-08-15 20:14:22 +00:00
|
|
|
|
|
|
|
echo " *** BOOTCLASSPATH=${BOOTCLASSPATH}"
|
|
|
|
echo " *** DALVIKVM_OPTS=${DALVIKVM_OPTS}"
|
2020-08-15 17:36:12 +00:00
|
|
|
fi
|
2018-09-08 17:21:26 +00:00
|
|
|
|
2020-10-17 18:23:32 +00:00
|
|
|
/system/bin/dalvikvm -Xnoimage-dex2oat ${DALVIKVM_OPTS} "${@}"
|
2018-09-05 19:31:44 +00:00
|
|
|
}
|
|
|
|
|
2018-10-20 21:56:49 +00:00
|
|
|
deodex_vdex () {
|
|
|
|
ui_print " >> deodexing services.jar [VDEX]"
|
|
|
|
|
2019-04-12 17:39:06 +00:00
|
|
|
cp /system/framework/oat/${ARCH}/services.vdex \
|
|
|
|
${BASEDIR}/services.vdex || \
|
|
|
|
error "failed to copy services.vdex"
|
|
|
|
|
|
|
|
${V_EX} -i ${BASEDIR}/services.vdex \
|
|
|
|
--ignore-crc-error --debug=4 || \
|
|
|
|
error "failed to deodex services.vdex"
|
|
|
|
|
|
|
|
mv ${BASEDIR}/services.apk_classes.dex ${BASEDIR}/classes.dex || \
|
|
|
|
error "failed to deodex services.vdex"
|
|
|
|
|
|
|
|
${ZIPB} -j "${BASEDIR}/services.jar" \
|
|
|
|
"${BASEDIR}/classes.dex" || \
|
|
|
|
error "zip failed"
|
2018-10-20 21:56:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
deodex_odex () {
|
|
|
|
ui_print " >> deodexing services.jar [ODEX]"
|
|
|
|
|
|
|
|
cp "/system/framework/oat/${ARCH}/services.odex" "${BASEDIR}"
|
2020-08-15 17:36:12 +00:00
|
|
|
|
2018-10-20 21:56:49 +00:00
|
|
|
# baksmali/smali options switches (version dependent)
|
|
|
|
if [ "${SDK_VERSION}" -lt 24 ]; then
|
|
|
|
MAIN=main
|
|
|
|
DEODEX="-x"
|
|
|
|
ASSEMBLE=
|
|
|
|
BOOTCLASSPATH="-c"
|
2020-08-15 17:36:12 +00:00
|
|
|
else
|
|
|
|
MAIN=Main
|
|
|
|
DEODEX="x"
|
|
|
|
ASSEMBLE="a"
|
|
|
|
BOOTCLASSPATH="-b"
|
|
|
|
CLASSPATHDIR="-d"
|
2018-10-20 21:56:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
ui_print " [1] baksmali services.odex"
|
|
|
|
|
2020-08-15 17:36:12 +00:00
|
|
|
call_dalvikvm \
|
2018-10-20 21:56:49 +00:00
|
|
|
-classpath "${BAKSMALI}" \
|
|
|
|
org.jf.baksmali.${MAIN} \
|
|
|
|
${DEODEX} \
|
|
|
|
${BOOTCLASSPATH} "/system/framework/${ARCH}/boot.oat" \
|
|
|
|
${CLASSPATHDIR} "/system/framework/${ARCH}" \
|
|
|
|
${CLASSPATHDIR} "/system/framework" \
|
|
|
|
-o "${BASEDIR}/services.jar-deodex" \
|
|
|
|
"${BASEDIR}/services.odex" || \
|
|
|
|
error "failed to deodex services.jar"
|
|
|
|
|
|
|
|
ui_print " [2] smali services.odex"
|
2020-08-15 17:36:12 +00:00
|
|
|
|
|
|
|
call_dalvikvm \
|
2018-10-20 21:56:49 +00:00
|
|
|
-classpath "${SMALI}" \
|
|
|
|
org.jf.smali.${MAIN} \
|
|
|
|
${ASSEMBLE} \
|
|
|
|
-o "${BASEDIR}/services.jar-deodex/classes.dex" \
|
|
|
|
"${BASEDIR}/services.jar-deodex" || \
|
|
|
|
error "failed to rebuild classes.dex"
|
2020-12-29 09:26:08 +00:00
|
|
|
|
2018-10-20 21:56:49 +00:00
|
|
|
${ZIPB} -j "${BASEDIR}/services.jar" \
|
|
|
|
"${BASEDIR}/services.jar-deodex"/classes*.dex || \
|
|
|
|
error "zip failed"
|
|
|
|
|
|
|
|
rm -rf "${BASEDIR}/services.jar-deodex"
|
|
|
|
}
|
|
|
|
|
2018-03-20 17:52:53 +00:00
|
|
|
patch_services () {
|
|
|
|
ui_print " "
|
|
|
|
ui_print " > patching signature spoofing support"
|
|
|
|
ui_print " "
|
|
|
|
|
|
|
|
cp /system/framework/services.jar \
|
|
|
|
${BASEDIR}/services.jar || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "failed to copy services.jar"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2018-08-25 19:43:43 +00:00
|
|
|
if [ "${ROM_DEX_STATUS}" = "VDEX" ]; then
|
2018-10-20 21:56:49 +00:00
|
|
|
deodex_vdex
|
2018-08-25 21:23:26 +00:00
|
|
|
elif [ "${ROM_DEX_STATUS}" = "ODEX" ]; then
|
2018-10-20 21:56:49 +00:00
|
|
|
deodex_odex
|
2018-08-25 19:43:43 +00:00
|
|
|
fi
|
2018-08-24 19:47:56 +00:00
|
|
|
|
|
|
|
mkdir -p "${BASEDIR}/services.jar-mod"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2019-03-17 20:03:13 +00:00
|
|
|
PATCHES="${PATCH_HOOK} ${PATCH_CORE}"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
|
|
|
ui_print " >> patching services.jar"
|
2018-10-20 21:56:49 +00:00
|
|
|
|
2020-08-15 17:36:12 +00:00
|
|
|
call_dalvikvm \
|
2020-01-17 20:10:23 +00:00
|
|
|
-classpath "${DEXPATCHER}" \
|
2018-03-20 17:52:53 +00:00
|
|
|
lanchon.dexpatcher.Main \
|
2020-08-15 17:43:15 +00:00
|
|
|
${DEX_OPTS} --api-level "${SDK_VERSION}" \
|
2020-08-15 17:36:12 +00:00
|
|
|
--verbose --debug \
|
|
|
|
--output ${BASEDIR}/services.jar-mod \
|
2018-03-20 17:52:53 +00:00
|
|
|
${BASEDIR}/services.jar ${PATCHES} || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "failed to apply patches"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2018-08-30 18:06:20 +00:00
|
|
|
${ZIPB} -d "${BASEDIR}/services.jar" \
|
2018-08-26 10:53:17 +00:00
|
|
|
'classes*.dex' || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "zip failed"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2018-08-30 18:06:20 +00:00
|
|
|
${ZIPB} -j "${BASEDIR}/services.jar" \
|
2018-08-26 10:53:17 +00:00
|
|
|
"${BASEDIR}/services.jar-mod"/classes*.dex || \
|
2018-09-06 18:43:18 +00:00
|
|
|
error "zip failed"
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_services () {
|
2020-08-24 17:18:31 +00:00
|
|
|
install_path=""
|
2018-03-20 17:52:53 +00:00
|
|
|
ui_print " "
|
|
|
|
|
2020-10-09 18:19:26 +00:00
|
|
|
if [ "${MODE}" = "MAGISK" ]; then
|
|
|
|
if [ -d "${MAGISKBASE}/modules/${MODID}" ]; then
|
2020-08-24 19:46:38 +00:00
|
|
|
install_path="${MAGISKBASE}/modules_update/${MODID}"
|
2020-08-24 17:18:31 +00:00
|
|
|
else
|
2020-08-24 19:46:38 +00:00
|
|
|
install_path="${MAGISKBASE}/modules/${MODID}"
|
2020-08-24 17:18:31 +00:00
|
|
|
fi
|
2018-03-20 17:52:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
ui_print " << installing patched files to: ${install_path}"
|
|
|
|
|
|
|
|
mkdir -p "${install_path}/system/framework"
|
2019-04-12 17:39:06 +00:00
|
|
|
cp ${BASEDIR}/services.jar "${install_path}/system/framework/" \
|
2018-09-06 18:43:18 +00:00
|
|
|
|| error "failed to install services.jar"
|
2019-04-20 11:08:07 +00:00
|
|
|
set_perm_data "${install_path}/system/framework/services.jar"
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2019-04-12 17:39:06 +00:00
|
|
|
cp "${BASEDIR}/org.spoofing.apk" "${install_path}/system/framework/"
|
2019-04-20 11:08:07 +00:00
|
|
|
set_perm_data "${install_path}/system/framework/org.spoofing.apk"
|
2019-04-12 17:39:06 +00:00
|
|
|
|
2020-08-24 17:18:31 +00:00
|
|
|
if [ "${MODE}" = "MAGISK" ]; then
|
2020-08-24 19:46:38 +00:00
|
|
|
cp -af "${BASEDIR}/module.prop" "${install_path}"
|
|
|
|
|
|
|
|
if ${BOOTMODE}; then
|
|
|
|
touch "${MAGISKBASE}/modules/${MODID}/update" 2>/dev/null
|
|
|
|
cp -af "${BASEDIR}/module.prop" "${MAGISKBASE}/${MODID}/module.prop" 2>/dev/null
|
|
|
|
fi
|
2020-08-24 17:18:31 +00:00
|
|
|
fi
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
# addon.d
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
install_addond () {
|
|
|
|
ui_print " "
|
|
|
|
ui_print " Installing addon.d restoration setup"
|
|
|
|
|
2018-09-08 18:20:07 +00:00
|
|
|
rm -rf ${PATCHER_ADDOND_DATA}
|
2018-08-29 15:01:33 +00:00
|
|
|
mkdir -p ${PATCHER_ADDOND_DATA}
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2020-08-15 17:36:39 +00:00
|
|
|
for file in core_services.jar.dex dexpatcher_19.dex dexpatcher_26.dex \
|
2020-04-04 12:12:19 +00:00
|
|
|
hook_4.1-6.0_services.jar.dex hook_7.0-10.0_services.jar.dex \
|
2020-08-15 19:01:29 +00:00
|
|
|
baksmali_19.dex baksmali_24.dex baksmali_26.dex \
|
|
|
|
smali_19.dex smali_24.dex smali_26.dex \
|
2019-04-12 17:39:06 +00:00
|
|
|
magic.mgc org.spoofing.apk; do
|
2018-08-29 15:01:33 +00:00
|
|
|
cp "${BASEDIR}/${file}" ${PATCHER_ADDOND_DATA}/
|
2018-03-20 17:52:53 +00:00
|
|
|
done
|
|
|
|
|
2018-08-29 15:01:33 +00:00
|
|
|
cp /dev/tmp/CommonPatcher ${PATCHER_ADDOND_DATA}/
|
2018-03-20 17:52:53 +00:00
|
|
|
|
2018-11-14 21:22:38 +00:00
|
|
|
for file in ${ZIPB} ${V_EX} ${BUSY} ${FILE}; do
|
2018-09-08 18:16:54 +00:00
|
|
|
cp ${file} ${PATCHER_ADDOND_DATA}/
|
|
|
|
chmod 0755 ${PATCHER_ADDOND_DATA}/$(basename "${file}")
|
|
|
|
done
|
2018-08-26 16:58:59 +00:00
|
|
|
|
2018-09-15 20:05:03 +00:00
|
|
|
cp "${BASEDIR}/70-nanodroidpatcher.sh" /system/addon.d/
|
|
|
|
chmod 0755 /system/addon.d/70-nanodroidpatcher.sh
|
2018-03-20 17:52:53 +00:00
|
|
|
}
|