You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NanoDroid/CommonAddon

66 lines
1.6 KiB
Plaintext

#!/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 () {
echo -n -e "ui_print ${1}\n" >> /proc/self/fd/${OUTFD}
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
}
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
echo " + backup: ${FILE}"
backup_file "${FILE}"
done
ui_print "${MODID} addon.d: backup done"
fi
;;
restore)
if [ -r /data/adb/.nanodroid-list ]; then
ui_print "${MODID} addon.d: restore"
cat /data/adb/.nanodroid-list | while read FILE; do
echo " + restore: ${FILE}"
restore_file "${FILE}"
done
ui_print "${MODID} addon.d: restore done"
fi
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
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})"
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
fi
;;
esac