2018-04-10 17:58:45 +00:00
|
|
|
#!/sbin/sh
|
2018-09-02 13:03:32 +00:00
|
|
|
#
|
|
|
|
# ADDOND_VERSION=2
|
|
|
|
#
|
2018-04-10 17:58:45 +00:00
|
|
|
##########################################################################################
|
|
|
|
#
|
|
|
|
# NanoDroid System Mode OTA 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
|
|
|
|
|
|
|
|
MODID=@MODID@
|
|
|
|
|
2018-08-24 22:28:06 +00:00
|
|
|
GOOGLE_APPS="AMAPNetworkLocation
|
|
|
|
BaiduNetworkLocation
|
|
|
|
BlankStore
|
|
|
|
com.qualcomm.location
|
|
|
|
DejaVuBackend
|
|
|
|
DejaVuNlpBackend
|
|
|
|
FDroidPriv
|
|
|
|
GmsCoreSetupPrebuilt
|
|
|
|
GmsCore_update
|
|
|
|
GmsDroidGuard
|
|
|
|
GoogleFeedback
|
2018-04-13 18:05:37 +00:00
|
|
|
GoogleLoginService
|
|
|
|
GoogleOneTimeInitializer
|
2018-08-24 22:01:20 +00:00
|
|
|
GoogleServicesFramework
|
|
|
|
GoogleTTS
|
2018-04-13 18:05:37 +00:00
|
|
|
IchnaeaNlpBackend
|
2018-08-24 22:28:06 +00:00
|
|
|
LegacyNetworkLocation
|
|
|
|
MarketUpdater
|
|
|
|
MarkupGoogle
|
2018-04-13 18:05:37 +00:00
|
|
|
MozillaNlpBackend
|
2018-08-24 22:28:06 +00:00
|
|
|
NetworkLocation
|
2018-04-13 18:05:37 +00:00
|
|
|
NominatimGeocoderBackend
|
2018-08-24 22:01:20 +00:00
|
|
|
NominatimNlpBackend
|
2018-08-24 22:28:06 +00:00
|
|
|
PlayGames
|
|
|
|
PlayStore
|
|
|
|
PrebuiltGmsCore
|
|
|
|
UnifiedNlp
|
|
|
|
Velvet
|
|
|
|
Vending
|
|
|
|
WhisperPush
|
|
|
|
YouTube"
|
2018-04-13 18:05:37 +00:00
|
|
|
|
2018-08-24 22:28:06 +00:00
|
|
|
GOOGLE_DATA="com.amap.android.location
|
|
|
|
com.baidu.location
|
2018-08-10 17:23:26 +00:00
|
|
|
com.google.android.feedback
|
|
|
|
com.google.android.gsf.login
|
2018-08-24 22:28:06 +00:00
|
|
|
com.google.android.location
|
2018-08-10 17:23:26 +00:00
|
|
|
com.google.android.youtube
|
2018-08-24 22:28:06 +00:00
|
|
|
com.mgoogle.android.gms
|
2018-08-10 17:23:26 +00:00
|
|
|
com.qualcomm.location
|
|
|
|
org.microg.nlp
|
|
|
|
org.microg.unifiednlp"
|
|
|
|
|
2018-08-21 19:34:56 +00:00
|
|
|
if [ ! -d /system/xbin ]; then
|
|
|
|
NANODROID_BINDIR=/system/bin
|
|
|
|
else NANODROID_BINDIR=/system/xbin
|
|
|
|
fi
|
|
|
|
|
2018-08-21 19:59:15 +00:00
|
|
|
if [ -r /data/adb/.nanodroid-list ]; then
|
|
|
|
NANODROID_LIST=/data/adb/.nanodroid-list
|
|
|
|
elif [ -r /data/adb/NanoDroid_FileList ]; then
|
|
|
|
NANODROID_LIST=/data/adb/NanoDroid_FileList
|
|
|
|
else
|
|
|
|
echo "No installer information found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-04-10 17:58:45 +00:00
|
|
|
ui_print () {
|
2018-04-10 19:13:11 +00:00
|
|
|
echo -n -e "ui_print ${1}\n" >> /proc/self/fd/${OUTFD}
|
|
|
|
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
|
2018-04-10 17:58:45 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 17:21:36 +00:00
|
|
|
detect_outfd () {
|
|
|
|
readlink /proc/$$/fd/${OUTFD} 2>/dev/null | grep /tmp >/dev/null
|
|
|
|
if [ "$?" -eq "0" ]; then
|
|
|
|
OUTFD=0
|
|
|
|
|
|
|
|
for FD in $(ls /proc/$$/fd); do
|
|
|
|
readlink /proc/$$/fd/${FD} 2>/dev/null | grep pipe >/dev/null
|
|
|
|
if [ "$?" -eq "0" ]; then
|
|
|
|
ps | grep " 3 ${FD} " | grep -v grep >/dev/null
|
|
|
|
if [ "$?" -eq "0" ]; then
|
|
|
|
OUTFD=${FD}
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-08-10 17:23:26 +00:00
|
|
|
solve_gappsconflicts () {
|
2018-04-13 18:05:37 +00:00
|
|
|
for app in ${GOOGLE_APPS}; do
|
2018-08-21 19:34:56 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
|
2018-04-13 18:05:37 +00:00
|
|
|
done
|
2018-08-10 17:23:26 +00:00
|
|
|
|
|
|
|
for app in ${GOOGLE_DATA}; do
|
|
|
|
rm -rf /data/data/${app}
|
|
|
|
rm -rf /data/user/*/${app}
|
|
|
|
rm -rf /data/user_de/*/${app}
|
|
|
|
rm -rf /data/app/${app}-*
|
|
|
|
done
|
2018-04-13 18:05:37 +00:00
|
|
|
}
|
|
|
|
|
2018-09-08 17:21:36 +00:00
|
|
|
detect_outfd
|
|
|
|
|
2018-04-10 17:58:45 +00:00
|
|
|
case "${1}" in
|
|
|
|
backup)
|
2018-08-21 19:59:15 +00:00
|
|
|
ui_print "${MODID} addon.d: backup"
|
|
|
|
cat ${NANODROID_LIST} | while read FILE; do
|
|
|
|
echo " + backup: ${FILE}"
|
|
|
|
backup_file "${FILE}"
|
|
|
|
done
|
2018-04-10 19:54:34 +00:00
|
|
|
|
2018-08-21 19:59:15 +00:00
|
|
|
if test -h /system/fonts/Roboto-Regular.ttf; then
|
|
|
|
CUSTOM_FONT="$(basename $(readlink /system/fonts/Roboto-Regular.ttf) .ttf)"
|
|
|
|
ui_print " ${MODID} addon.d: detected NanoDroid-Font (${CUSTOM_FONT})"
|
2018-04-10 19:54:34 +00:00
|
|
|
|
2018-08-21 19:59:15 +00:00
|
|
|
echo CUSTOM_FONT=${CUSTOM_FONT} > /tmp/nanodroid_font
|
2018-04-10 17:58:45 +00:00
|
|
|
fi
|
2018-08-21 19:59:15 +00:00
|
|
|
|
|
|
|
ui_print "${MODID} addon.d: backup done"
|
2018-04-10 17:58:45 +00:00
|
|
|
;;
|
|
|
|
restore)
|
2018-08-21 19:59:15 +00:00
|
|
|
ui_print "${MODID} addon.d: restore"
|
|
|
|
cat ${NANODROID_LIST} | while read FILE; do
|
|
|
|
echo " + restore: ${FILE}"
|
|
|
|
restore_file "${FILE}"
|
|
|
|
done
|
|
|
|
ui_print "${MODID} addon.d: restore done"
|
2018-04-10 17:58:45 +00:00
|
|
|
;;
|
|
|
|
pre-backup)
|
|
|
|
# Stub
|
|
|
|
;;
|
|
|
|
post-backup)
|
|
|
|
# Stub
|
|
|
|
;;
|
|
|
|
pre-restore)
|
|
|
|
# Stub
|
|
|
|
;;
|
|
|
|
post-restore)
|
2018-04-10 19:54:34 +00:00
|
|
|
if [ -f /tmp/nanodroid_font ]; then
|
|
|
|
. /tmp/nanodroid_font
|
|
|
|
ui_print " ${MODID} addon.d: restoring NanoDroid-Font (${CUSTOM_FONT})"
|
2018-04-10 18:03:50 +00:00
|
|
|
|
2018-08-21 19:34:56 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-font -s "${CUSTOM_FONT}"
|
2018-04-10 19:54:34 +00:00
|
|
|
rm /tmp/nanodroid_font
|
2018-04-10 18:03:50 +00:00
|
|
|
fi
|
2018-04-13 18:05:37 +00:00
|
|
|
|
2018-08-10 17:23:26 +00:00
|
|
|
solve_gappsconflicts
|
2018-04-10 17:58:45 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|