2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-22 01:37:40 +00:00
NanoDroid/patcher/dexpatcher/999-nanodroidpatcher.sh

110 lines
2.4 KiB
Bash
Raw Normal View History

2018-01-23 20:11:52 +00:00
#!/sbin/sh
##########################################################################################
#
# NanoDroid Patcher survival script
# by Nanolx
#
# Inspired by 99-flashafterupdate.sh of osm0sis @ xda-developers
# Forked from 99-magisk.sh of topjohnwu @ xda-developers
#
##########################################################################################
. /tmp/backuptool.functions
if [ ! -f /data/adb/nanodroid_patcher/CommonPatcher ]; then
echo " !! failed to load CommonPatcher"
2018-01-23 20:11:52 +00:00
exit 1
else
source "/data/adb/nanodroid_patcher/CommonPatcher"
fi
2018-01-23 20:11:52 +00:00
setup_environment
BASEDIR=/data/adb/nanodroid_patcher
PATCH_CORE="${BASEDIR}/core_services.jar.dex"
2018-01-23 20:11:52 +00:00
NanoDroidPatcher () {
2018-01-23 20:11:52 +00:00
ui_print " "
ui_print "*******************************"
ui_print " NanoDroid Framework Patcher "
2018-04-04 17:58:49 +00:00
ui_print " addon.d 16.90.99999999 "
2018-01-23 20:11:52 +00:00
ui_print " created by @Nanolx "
ui_print " Utilizing DexPatcher @lanchon "
ui_print "*******************************"
ui_print " "
mount_partitions
2018-01-23 20:11:52 +00:00
[ -f /data/adb/.nanodroid-patcher ] && \
rm -f /data/adb/.nanodroid-patcher
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
2018-01-23 20:11:52 +00:00
for bin in zip.arm zip.x86 file.arm file.x86; do
chmod 0755 "${BASEDIR}/${bin}" || \
error " !! failed to prepare environment"
done
detect_sdk
detect_arch
detect_odex
[ -f ${MAGISK_IMG} ] && magisk_setup
patch_services
install_services
ui_print " "
ui_print " >> clean up"
magisk_cleanup
ui_print " "
ui_print " > Done!"
ui_print " "
ui_print "Thanks for using NanoDroid"
ui_print " "
exit 0
}
##########################################################################################
# Check environment
##########################################################################################
if [[ ! -d /data/adb/nanodroid_patcher ]]; then
ui_print " "
ui_print " !! NanoDroid-Patcher environment missing"
ui_print " !! guessing, you've wiped /data ?"
ui_print " !! re-flash the NanoDroid-Patcher zip"
ui_print " "
exit 0
fi
##########################################################################################
# Stuffz
##########################################################################################
case "${1}" in
2018-01-23 20:11:52 +00:00
backup)
# Stub
;;
restore)
# Stub
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
OUTFD=$(ps | grep -v grep | grep -oE "update(.*)" | cut -d" " -f3)
NanoDroidPatcher
2018-01-23 20:11:52 +00:00
;;
esac