2018-04-10 17:58:45 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
##########################################################################################
|
|
|
|
#
|
|
|
|
# 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@
|
|
|
|
OUTFD=$(ps | grep -v grep | grep -oE "update(.*)" | cut -d" " -f3)
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
backup)
|
|
|
|
if [ -r /data/adb/.nanodroid-list ]; then
|
|
|
|
ui_print "${MODID} addon.d: backup"
|
|
|
|
cat /data/adb/.nanodroid-list | while read FILE; do
|
2018-04-10 19:13:11 +00:00
|
|
|
echo " + backup: ${FILE}"
|
2018-04-10 18:18:07 +00:00
|
|
|
backup_file "${FILE}"
|
2018-04-10 17:58:45 +00:00
|
|
|
done
|
2018-04-10 19:54:34 +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})"
|
|
|
|
|
|
|
|
echo CUSTOM_FONT=${CUSTOM_FONT} > /tmp/nanodroid_font
|
|
|
|
fi
|
|
|
|
|
2018-04-10 17:58:45 +00:00
|
|
|
ui_print "${MODID} addon.d: backup done"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
restore)
|
|
|
|
if [ -r /data/adb/.nanodroid-list ]; then
|
|
|
|
ui_print "${MODID} addon.d: restore"
|
2018-04-10 18:18:07 +00:00
|
|
|
cat /data/adb/.nanodroid-list | while read FILE; do
|
2018-04-10 19:13:11 +00:00
|
|
|
echo " + restore: ${FILE}"
|
|
|
|
restore_file "${FILE}"
|
2018-04-10 17:58:45 +00:00
|
|
|
done
|
|
|
|
ui_print "${MODID} addon.d: restore done"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
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
|
|
|
|
|
|
|
if [ -f /system/xbin/nanodroid-font ]; then
|
|
|
|
/system/xbin/nanodroid-font -s "${CUSTOM_FONT}"
|
|
|
|
elif [ -f /system/bin/nanodroid-font ]; then
|
|
|
|
/system/bin/nanodroid-font -s "${CUSTOM_FONT}"
|
|
|
|
fi
|
2018-04-10 19:54:34 +00:00
|
|
|
|
|
|
|
rm /tmp/nanodroid_font
|
2018-04-10 18:03:50 +00:00
|
|
|
fi
|
2018-04-10 17:58:45 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|