mirror of
https://gitlab.com/Nanolx/NanoDroid
synced 2024-10-31 09:20:23 +00:00
63 lines
1.5 KiB
Bash
63 lines
1.5 KiB
Bash
#!/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@
|
|
|
|
##########################################################################################
|
|
# Stuffz
|
|
##########################################################################################
|
|
|
|
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
|
|
test -z "${FILE}" && continue
|
|
echo " ${S}/${FILE}"
|
|
backup_file "${S}/${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 REPLACEMENT; do
|
|
test -z "${FILE}" && continue
|
|
[ -f "${C}/${S}/${FILE}" ] && restore_file "${S}/${FILE}" "${FILE}"
|
|
done
|
|
ui_print "${MODID} addon.d: restore done"
|
|
fi
|
|
;;
|
|
pre-backup)
|
|
# Stub
|
|
;;
|
|
post-backup)
|
|
# Stub
|
|
;;
|
|
pre-restore)
|
|
# Stub
|
|
;;
|
|
post-restore)
|
|
# Stub
|
|
;;
|
|
esac
|
|
|