System Mode: work-in-progress OTA survival (addon.d)

merge-requests/23/head
Christopher Roy Bratusek 6 years ago
parent 968ff6b6f9
commit a8c568dc78

@ -0,0 +1,62 @@
#!/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

@ -311,6 +311,8 @@ unpack_zip () {
nanodroid_finalize () {
[ "${MODE}" = "MAGISK" ] && magisk_install_finish
[ "${MODE}" = "SYSTEM" ] && install_addond
rm -rf ${INSTALLER}
ui_print " "
@ -852,6 +854,20 @@ install_swipe () {
fi
}
install_addond () {
if [ -d /system/addon.d ]; then
ui_print " << System Mode OTA survival"
cp "${INSTALLER}/CommonAddon" "/system/addon.d/91-nanodroid.sh" || \
error " !! failed to install System Mode OTA survival"
chmod 0755 "/system/addon.d/91-nanodroid.sh"
sed -e "s|@MODID@|${MODID}|g" -i "/system/addon.d/91-nanodroid.sh"
else
ui_print " << ROM does not have addon.d support"
fi
}
##########################################################################################
# Advanced Installation Functions
##########################################################################################

Loading…
Cancel
Save