2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-31 09:20:23 +00:00

CommonAddon:

- during post-restore action create NanoDroid-Overlay
- fix crashes during addon.d post-restore action
This commit is contained in:
Christopher Roy Bratusek 2018-09-09 15:11:20 +02:00
parent 0c674a70d3
commit 3a6f959abd
2 changed files with 69 additions and 17 deletions

View File

@ -10,6 +10,9 @@
* CommonAddon, PatcherAddon
* fix printing messages
* CommonAddon
* fix crashes during addon.d post-restore action
* PatcherAddon
* fix DalvikVM crash
@ -24,6 +27,9 @@
* CommonInstaller
* code simplifications
* CommonAddon
* during post-restore action create NanoDroid-Overlay
* CommonPatcher
* tell DalvikVM to be more verbose
* remove ancient, unused files from addon.d

View File

@ -79,17 +79,43 @@ ui_print () {
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
}
solve_gappsconflicts () {
for app in ${GOOGLE_APPS}; do
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
done
grep_prop() {
REGEX="${1}"
shift
FILES="${@}"
[ -z "${@}" ] && FILES='/system/build.prop'
sed -n "s/^${REGEX}=//p" ${FILES} | \
head -n 1
}
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
set_ldlibrarypath () {
SDK_VERSION=$(grep_prop ro.build.version.sdk)
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
ABILONG=$(grep_prop ro.product.cpu.abi)
OLD_LD=${LD_LIBRARY_PATH}
OLD_PATH=${PATH}
ARCH=arm
[ "$ABI" = "x86" ] && ARCH=x86
[ "$ABI2" = "x86" ] && ARCH=x86
[ "$ABILONG" = "arm64-v8a" ] && ARCH=arm64
[ "$ABILONG" = "x86_64" ] && ARCH=x64
case ${ARCH} in
arm | x86 )
export LD_LIBRARY_PATH=/system/lib:/system/vendor/lib:/vendor/lib
;;
arm64 | x86_64 )
export LD_LIBRARY_PATH=/system/lib64:/system/vendor/lib64:/vendor/lib64
;;
esac
export PATH=/system/bin:/system/xbin:${PATH}
}
detect_outfd () {
@ -111,7 +137,7 @@ detect_outfd
backup_action () {
sleep 5
ui_print "${MODID} addon.d: backup"
ui_print " ++ ${MODID} addon.d: backup"
cat ${NANODROID_LIST} | while read FILE; do
echo " + backup: ${FILE}"
backup_file "${FILE}"
@ -119,37 +145,57 @@ backup_action () {
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})"
ui_print " ++ ${MODID} addon.d: detected NanoDroid-Font (${CUSTOM_FONT})"
echo CUSTOM_FONT=${CUSTOM_FONT} > /tmp/nanodroid_font
fi
ui_print "${MODID} addon.d: backup done"
ui_print " ++ ${MODID} addon.d: backup done"
}
restore_action () {
sleep 5
ui_print "${MODID} addon.d: restore"
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"
ui_print " ++ ${MODID} addon.d: restore done"
}
postrestore_action () {
sleep 5
set_ldlibrarypath
if [ -f /tmp/nanodroid_font ]; then
source /tmp/nanodroid_font
ui_print " ${MODID} addon.d: restoring NanoDroid-Font (${CUSTOM_FONT})"
ui_print " ++ ${MODID} addon.d: restoring NanoDroid-Font (${CUSTOM_FONT})"
${NANODROID_BINDIR}/nanodroid-font -s "${CUSTOM_FONT}"
rm /tmp/nanodroid_font
fi
solve_gappsconflicts
ui_print " ++ ${MODID} addon.d: GApps removal"
for app in ${GOOGLE_APPS}; do
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
done
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
ui_print " ++ ${MODID} addon.d: GApps removal done"
ui_print " ++ ${MODID} addon.d: creating Overlays"
${NANODROID_BINDIR}/nanodroid-overlay --create
ui_print " ++ ${MODID} addon.d: creating Overlays done"
export PATH=${OLD_PATH}
export LD_LIBRARY_PATH=${OLD_LD}
}
case "${1}" in