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

* CommonInstaller, CommmonAddon, Uninstaller

* move installer information for System Mode from /data/adb/.nanodroid-list to /data/adb/NanoDroid_FileList
  * CommonAddon and Uninstaller support both
  * simplify code for the creation of the installer information
This commit is contained in:
Christopher Roy Bratusek 2018-08-21 21:59:15 +02:00
parent 373bd01145
commit 96a5998605
4 changed files with 73 additions and 62 deletions

View File

@ -17,9 +17,18 @@
* don't set progressbar when flashing from Magisk Manager
* when migrating from Play Store to Fake Store or vice versa during new installs get rid of that store's app data, too
* minor string change
* CommonAddon
* code simplifcations
* CommonInstaller, CommmonAddon, Uninstaller
* move installer information for System Mode from /data/adb/.nanodroid-list to /data/adb/NanoDroid_FileList
* CommonAddon and Uninstaller support both
* simplify code for the creation of the installer information
* Uninstaller
* remove support for ancient versions (< 12.0)
### Updates
* automatic

View File

@ -59,6 +59,15 @@ if [ ! -d /system/xbin ]; then
else NANODROID_BINDIR=/system/xbin
fi
if [ -r /data/adb/.nanodroid-list ]; then
NANODROID_LIST=/data/adb/.nanodroid-list
elif [ -r /data/adb/NanoDroid_FileList ]; then
NANODROID_LIST=/data/adb/NanoDroid_FileList
else
echo "No installer information found!"
exit 1
fi
ui_print () {
echo -n -e "ui_print ${1}\n" >> /proc/self/fd/${OUTFD}
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
@ -79,32 +88,28 @@ solve_gappsconflicts () {
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"
cat ${NANODROID_LIST} | while read FILE; do
echo " + backup: ${FILE}"
backup_file "${FILE}"
done
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 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
ui_print "${MODID} addon.d: backup done"
echo CUSTOM_FONT=${CUSTOM_FONT} > /tmp/nanodroid_font
fi
ui_print "${MODID} addon.d: backup done"
;;
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
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"
;;
pre-backup)
# Stub

View File

@ -2,6 +2,7 @@
VERSION=17.10.99999999
NANODROID_UPGRADE=0
NANODROID_LIST=/data/adb/NanoDroid_FileList
GOOGLE_APPS="GoogleFeedback
GoogleLoginService
@ -131,6 +132,14 @@ set_perm_bin () {
fi
}
filelist_add () {
if [ "${MODE}" = "SYSTEM" ]; then
for file in ${@}; do
echo ${file} >> ${NANODROID_LIST}
done
fi
}
detect_outfd () {
readlink /proc/$$/fd/${OUTFD} 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
@ -256,13 +265,13 @@ detect_mode () {
ui_print " "
if [ "${MODE}" = "SYSTEM" ]; then
if test -f /data/adb/.nanodroid-list -o \
if test -f ${NANODROID_LIST} -o \
-f /data/adb/.nanodroid-list -o \
-f /data/adb/.nanomod-list -o \
-f /system/.nanomod-list -o \
-f /system/addon.d/91-nanodroid.sh; then
NANODROID_UPGRADE=1
else
NANODROID_UPGRADE=0
else NANODROID_UPGRADE=0
fi
recovery_actions
@ -323,8 +332,8 @@ nanodroid_finalize () {
install_addond
recovery_cleanup
sort /data/adb/.nanodroid-list | uniq > /tmp/nanodroid-list
mv /tmp/nanodroid-list /data/adb/.nanodroid-list
sort ${NANODROID_LIST} | uniq > /tmp/nanodroid-list
mv /tmp/nanodroid-list ${NANODROID_LIST}
fi
rm -rf ${INSTALLER}
@ -718,9 +727,7 @@ install_gsync () {
set_perm_data -r "${MODPATH}/system/app/Google${app}"
[ "${MODE}" = "SYSTEM" ] && \
echo "/system/app/Google${app}/Google${app}.apk" \
>> /data/adb/.nanodroid-list
filelist_add "/system/app/Google${app}/Google${app}.apk"
done
echo " installing app: GoogleBackupTransport"
@ -732,17 +739,14 @@ install_gsync () {
set_perm_data -r "${MODPATH}/system/priv-app/GoogleBackupTransport"
[ "${MODE}" = "SYSTEM" ] && \
echo "/system/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk" \
>> /data/adb/.nanodroid-list
filelist_add "/system/priv-app/GoogleBackupTransport/GoogleBackupTransport.apk"
cp -r "${INSTALLER}/gsync/etc/permissions/" "${MODPATH}/system/etc/"
set_perm_data -r "${MODPATH}/system/etc/permissions/"
[ "${MODE}" = "SYSTEM" ] && \
find "${INSTALLER}/gsync/etc/permissions/" -type f |
sed -e "s,${INSTALLER}/gsync/etc,/system/etc,g" \
>> /data/adb/.nanodroid-list
LIST=$(find "${INSTALLER}/gsync/etc/permissions/" -type f |
sed -e "s,${INSTALLER}/gsync/etc,/system/etc,g")
filelist_add "${LIST}"
fi
else ui_print " << without Google Sync Adapters"
fi
@ -952,11 +956,9 @@ install_initd () {
cp "${INSTALLER}/system/etc/init.d"/* "${INIT_BASE}/"
set_perm_bin "${INIT_BASE}"
[ "${MODE}" = "SYSTEM" ] && \
for init in fstrim logcat logscleaner sqlite external_sd; do
echo "/system/etc/init.d/${init}" \
>> /data/adb/.nanodroid-list
done
for init in fstrim logcat logscleaner sqlite external_sd; do
filelist_add "/system/etc/init.d/${init}"
done
else ui_print " << without init scripts"
fi
}
@ -975,9 +977,7 @@ install_swipe () {
error " !! failed to install libjni_${lib}.so"
set_perm_data "${MODPATH}${SWIPE_DEST}/libjni_${lib}.so"
[ "${MODE}" = "SYSTEM" ] && \
echo "${SWIPE_DEST}/libjni_${lib}.so" \
>> /data/adb/.nanodroid-list
filelist_add "${SWIPE_DEST}/libjni_${lib}.so"
done
else ui_print " << without swipe libraries"
fi
@ -1019,10 +1019,9 @@ nanodroid_install_dir () {
* ) set_perm_data -r "${MODPATH}${dest}" ;;
esac
[ "${MODE}" = "SYSTEM" ] && \
find "${INSTALLER}/system/${dir}" -type f | \
sed -e "s,^${INSTALLER},,g" \
>> /data/adb/.nanodroid-list
LIST=$(find "${INSTALLER}/system/${dir}" -type f | \
sed -e "s,^${INSTALLER},,g")
filelist_add ${LIST}
}
nanodroid_install_apk () {
@ -1053,8 +1052,7 @@ nanodroid_install_apk () {
set_perm_data -r "${MODPATH}/${dest}"
[ "${MODE}" = "SYSTEM" ] && \
echo "/${dest}/${app}.apk" >> /data/adb/.nanodroid-list
filelist_add "/${dest}/${app}.apk"
nanodroid_install_lib
}
@ -1084,8 +1082,7 @@ nanodroid_install_file () {
* ) set_perm_data "${MODPATH}/system/${xdir}/${xfile}" ;;
esac
[ "${MODE}" = "SYSTEM" ] && \
echo "/system/${xdir}/${xfile}" >> /data/adb/.nanodroid-list
filelist_add "/system/${xdir}/${xfile}"
}
nanodroid_install_lib () {
@ -1147,9 +1144,7 @@ nanodroid_install_lib () {
set_perm_data ${libd}/${lib_arch}/$(basename ${lib})
[ "${MODE}" = "SYSTEM" ] && \
echo /${dir}/${app}/lib/${lib_arch}/$(basename ${lib}) \
>> /data/adb/.nanodroid-list
filelist_add /${dir}/${app}/lib/${lib_arch}/$(basename ${lib})
done
fi
fi

View File

@ -144,6 +144,11 @@ mount_partitions () {
fi
[ ! -f /system/build.prop ] && error "failed to mount /system (unsupported A/B device?)"
if [ ! -d /system/xbin ]; then
NANODROID_BINDIR=/system/bin
else NANODROID_BINDIR=/system/xbin
fi
}
# check for configuration files
@ -160,11 +165,7 @@ system_mode_uninstall () {
ui_print " << Detected NanoDroid-Font (${CUSTOM_FONT})"
ui_print " < Restoring original Font"
if [ -f /system/xbin/nanodroid-font ]; then
/system/xbin/nanodroid-font -r
elif [ -f /system/bin/nanodroid-font ]; then
/system/bin/nanodroid-font -r
fi
${NANODROID_BINDIR}/nanodroid-font -r
fi
# services.jar needs special treament
@ -277,10 +278,11 @@ rm -f /data/adb/.nanodroid_*
rm -f /data/adb/.recovery_*
# new format
rm -f /data/adb/NanoDroid*
rm -f /data/adb/NanoDroid_log*
rm -f /data/adb/NanoDroid_twrp*
# System Mode uninstallation
for install_info in /system/.nanomod-list /data/adb/.nanomod-list \
for install_info in /system/.nanomod-list /data/adb/.nanomod-list /data/adb/NanoDroid_FileList \
/data/adb/.nanodroid-list; do
if [ -f ${install_info} ]; then
system_mode_uninstall ${install_info}